/** * Converts this object to a LocalDate with the same month-day and chronology. * * @param year the year to use, valid for chronology * @return a LocalDate with the same month-day and chronology, never null */ public LocalDate toLocalDate(int year) { return new LocalDate(year, getMonthOfYear(), getDayOfMonth(), getChronology()); }
/** * Converts this object to a LocalDate with the same month-day and chronology. * * @param year the year to use, valid for chronology * @return a LocalDate with the same month-day and chronology, never null */ public LocalDate toLocalDate(int year) { return new LocalDate(year, getMonthOfYear(), getDayOfMonth(), getChronology()); }
/** * Handle broken serialization from other tools. * @return the resolved object, not null */ private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new MonthDay(this, getChronology().withUTC()); } return this; }
/** * Handle broken serialization from other tools. * @return the resolved object, not null */ private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new MonthDay(this, getChronology().withUTC()); } return this; }
/** * Returns a copy of this month-day with the day of month field updated. * <p> * MonthDay is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * day of month changed. * * @param dayOfMonth the day of month to set * @return a copy of this object with the field set, never null * @throws IllegalArgumentException if the value is invalid */ public MonthDay withDayOfMonth(int dayOfMonth) { int[] newValues = getValues(); newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth); return new MonthDay(this, newValues); }
/** * Returns a copy of this month-day with the month of year field updated. * <p> * MonthDay is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * month of year changed. * * @param monthOfYear the month of year to set * @return a copy of this object with the field set, never null * @throws IllegalArgumentException if the value is invalid */ public MonthDay withMonthOfYear(int monthOfYear) { int[] newValues = getValues(); newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear); return new MonthDay(this, newValues); }
/** * Returns a copy of this month-day with the day of month field updated. * <p> * MonthDay is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * day of month changed. * * @param dayOfMonth the day of month to set * @return a copy of this object with the field set, never null * @throws IllegalArgumentException if the value is invalid */ public MonthDay withDayOfMonth(int dayOfMonth) { int[] newValues = getValues(); newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth); return new MonthDay(this, newValues); }
/** * Returns a copy of this month-day with the month of year field updated. * <p> * MonthDay is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * month of year changed. * * @param monthOfYear the month of year to set * @return a copy of this object with the field set, never null * @throws IllegalArgumentException if the value is invalid */ public MonthDay withMonthOfYear(int monthOfYear) { int[] newValues = getValues(); newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear); return new MonthDay(this, newValues); }
/** * Returns a copy of this month-day with the specified chronology. * This instance is immutable and unaffected by this method call. * <p> * This method retains the values of the fields, thus the result will * typically refer to a different instant. * <p> * The time zone of the specified chronology is ignored, as MonthDay * operates without a time zone. * * @param newChronology the new chronology, null means ISO * @return a copy of this month-day with a different chronology, never null * @throws IllegalArgumentException if the values are invalid for the new chronology */ public MonthDay withChronologyRetainFields(Chronology newChronology) { newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { MonthDay newMonthDay = new MonthDay(this, newChronology); newChronology.validate(newMonthDay, getValues()); return newMonthDay; } }
/** * Returns a copy of this month-day with the specified chronology. * This instance is immutable and unaffected by this method call. * <p> * This method retains the values of the fields, thus the result will * typically refer to a different instant. * <p> * The time zone of the specified chronology is ignored, as MonthDay * operates without a time zone. * * @param newChronology the new chronology, null means ISO * @return a copy of this month-day with a different chronology, never null * @throws IllegalArgumentException if the values are invalid for the new chronology */ public MonthDay withChronologyRetainFields(Chronology newChronology) { newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { MonthDay newMonthDay = new MonthDay(this, newChronology); newChronology.validate(newMonthDay, getValues()); return newMonthDay; } }
/** * Converts this object to a LocalDate with the same month-day and chronology. * * @param year the year to use, valid for chronology * @return a LocalDate with the same month-day and chronology, never null */ public LocalDate toLocalDate(int year) { return new LocalDate(year, getMonthOfYear(), getDayOfMonth(), getChronology()); }
/** * Handle broken serialization from other tools. * @return the resolved object, not null */ private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new MonthDay(this, getChronology().withUTC()); } return this; }
/** * Returns a copy of this month-day with the day of month field updated. * <p> * MonthDay is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * day of month changed. * * @param dayOfMonth the day of month to set * @return a copy of this object with the field set, never null * @throws IllegalArgumentException if the value is invalid */ public MonthDay withDayOfMonth(int dayOfMonth) { int[] newValues = getValues(); newValues = getChronology().dayOfMonth().set(this, DAY_OF_MONTH, newValues, dayOfMonth); return new MonthDay(this, newValues); }
/** * Returns a copy of this month-day with the month of year field updated. * <p> * MonthDay is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * month of year changed. * * @param monthOfYear the month of year to set * @return a copy of this object with the field set, never null * @throws IllegalArgumentException if the value is invalid */ public MonthDay withMonthOfYear(int monthOfYear) { int[] newValues = getValues(); newValues = getChronology().monthOfYear().set(this, MONTH_OF_YEAR, newValues, monthOfYear); return new MonthDay(this, newValues); }
/** * Returns a copy of this month-day with the specified chronology. * This instance is immutable and unaffected by this method call. * <p> * This method retains the values of the fields, thus the result will * typically refer to a different instant. * <p> * The time zone of the specified chronology is ignored, as MonthDay * operates without a time zone. * * @param newChronology the new chronology, null means ISO * @return a copy of this month-day with a different chronology, never null * @throws IllegalArgumentException if the values are invalid for the new chronology */ public MonthDay withChronologyRetainFields(Chronology newChronology) { newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { MonthDay newMonthDay = new MonthDay(this, newChronology); newChronology.validate(newMonthDay, getValues()); return newMonthDay; } }
/** * Converts this object to a LocalDate with the same month-day and chronology. * * @param year the year to use, valid for chronology * @return a LocalDate with the same month-day and chronology, never null */ public LocalDate toLocalDate(int year) { return new LocalDate(year, getMonthOfYear(), getDayOfMonth(), getChronology()); }
/** * Converts this object to a LocalDate with the same month-day and chronology. * * @param year the year to use, valid for chronology * @return a LocalDate with the same month-day and chronology, never null */ public LocalDate toLocalDate(int year) { return new LocalDate(year, getMonthOfYear(), getDayOfMonth(), getChronology()); }
/** * Handle broken serialization from other tools. * @return the resolved object, not null */ private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new MonthDay(this, getChronology().withUTC()); } return this; }
/** * Handle broken serialization from other tools. * @return the resolved object, not null */ private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new MonthDay(this, getChronology().withUTC()); } return this; }
/** * Handle broken serialization from other tools. * @return the resolved object, not null */ private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new MonthDay(this, getChronology().withUTC()); } return this; }