Refine search
/** * Sets this field in a copy of the LocalDate. * <p> * The LocalDate attached to this property is unchanged by this call. * * @param value the value to set the field in the copy to * @return a copy of the LocalDate with the field value changed * @throws IllegalArgumentException if the value isn't valid */ public LocalDate setCopy(int value) { return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), value)); }
/** * Returns a copy of this date with the partial set of fields replacing * those from this instance. * <p> * For example, if the partial contains a year and a month then those two * fields will be changed in the returned instance. * Unsupported fields are ignored. * If the partial is null, then <code>this</code> is returned. * * @param partial the partial set of fields to apply to this date, null ignored * @return a copy of this date with a different set of fields * @throws IllegalArgumentException if any value is invalid */ public LocalDate withFields(ReadablePartial partial) { if (partial == null) { return this; } return withLocalMillis(getChronology().set(partial, getLocalMillis())); }
/** * Returns a copy of this date with the partial set of fields replacing * those from this instance. * <p> * For example, if the partial contains a year and a month then those two * fields will be changed in the returned instance. * Unsupported fields are ignored. * If the partial is null, then <code>this</code> is returned. * * @param partial the partial set of fields to apply to this date, null ignored * @return a copy of this date with a different set of fields * @throws IllegalArgumentException if any value is invalid */ public LocalDate withFields(ReadablePartial partial) { if (partial == null) { return this; } return withLocalMillis(getChronology().set(partial, getLocalMillis())); }
/** * Rounds to the nearest whole unit of this field on a copy of this * LocalDate. If halfway, the ceiling is favored over the floor * only if it makes this field's value even. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundHalfEvenCopy() { return iInstant.withLocalMillis(iField.roundHalfEven(iInstant.getLocalMillis())); } }
/** * Returns a copy of this date with the era field updated. * <p> * LocalDate is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * era changed. * * @param era the era to set * @return a copy of this object with the field set * @throws IllegalArgumentException if the value is invalid */ public LocalDate withEra(int era) { return withLocalMillis(getChronology().era().set(getLocalMillis(), era)); }
/** * Adds to this field in a copy of this LocalDate. * <p> * The LocalDate attached to this property is unchanged by this call. * * @param value the value to add to the field in the copy * @return a copy of the LocalDate with the field value changed * @throws IllegalArgumentException if the value isn't valid */ public LocalDate addToCopy(int value) { return iInstant.withLocalMillis(iField.add(iInstant.getLocalMillis(), value)); }
/** * Returns a copy of this date with the day of month field updated. * <p> * LocalDate 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 * @throws IllegalArgumentException if the value is invalid */ public LocalDate withDayOfMonth(int dayOfMonth) { return withLocalMillis(getChronology().dayOfMonth().set(getLocalMillis(), dayOfMonth)); }
/** * Rounds to the nearest whole unit of this field on a copy of this * LocalDate, favoring the floor if halfway. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundHalfFloorCopy() { return iInstant.withLocalMillis(iField.roundHalfFloor(iInstant.getLocalMillis())); }
/** * Returns a copy of this date with the year field updated. * <p> * LocalDate is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * year changed. * * @param year the year to set * @return a copy of this object with the field set * @throws IllegalArgumentException if the value is invalid */ public LocalDate withYear(int year) { return withLocalMillis(getChronology().year().set(getLocalMillis(), year)); }
/** * Rounds to the nearest whole unit of this field on a copy of this * LocalDate, favoring the ceiling if halfway. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundHalfCeilingCopy() { return iInstant.withLocalMillis(iField.roundHalfCeiling(iInstant.getLocalMillis())); }
/** * Returns a copy of this date with the day of year field updated. * <p> * LocalDate is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * day of year changed. * * @param dayOfYear the day of year to set * @return a copy of this object with the field set * @throws IllegalArgumentException if the value is invalid */ public LocalDate withDayOfYear(int dayOfYear) { return withLocalMillis(getChronology().dayOfYear().set(getLocalMillis(), dayOfYear)); }
/** * Rounds to the nearest whole unit of this field on a copy of this * LocalDate, favoring the ceiling if halfway. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundHalfCeilingCopy() { return iInstant.withLocalMillis(iField.roundHalfCeiling(iInstant.getLocalMillis())); }
/** * Returns a copy of this date with the year of era field updated. * <p> * LocalDate is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * year of era changed. * * @param yearOfEra the year of era to set * @return a copy of this object with the field set * @throws IllegalArgumentException if the value is invalid */ public LocalDate withYearOfEra(int yearOfEra) { return withLocalMillis(getChronology().yearOfEra().set(getLocalMillis(), yearOfEra)); }
/** * Rounds to the highest whole unit of this field on a copy of this * LocalDate. * <p> * For example, rounding floor on the hourOfDay field of a LocalDate * where the time is 10:30 would result in new LocalDate with the * time of 11:00. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundCeilingCopy() { return iInstant.withLocalMillis(iField.roundCeiling(iInstant.getLocalMillis())); }
/** * Returns a copy of this date with the year of century field updated. * <p> * LocalDate is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * year of century changed. * * @param yearOfCentury the year of century to set * @return a copy of this object with the field set * @throws IllegalArgumentException if the value is invalid */ public LocalDate withYearOfCentury(int yearOfCentury) { return withLocalMillis(getChronology().yearOfCentury().set(getLocalMillis(), yearOfCentury)); }
/** * Sets this field in a copy of the LocalDate to a parsed text value. * <p> * The LocalDate attached to this property is unchanged by this call. * * @param text the text value to set * @param locale optional locale to use for selecting a text symbol * @return a copy of the LocalDate with the field value changed * @throws IllegalArgumentException if the text value isn't valid */ public LocalDate setCopy(String text, Locale locale) { return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), text, locale)); }
/** * Returns a copy of this date with the month of year field updated. * <p> * LocalDate 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 * @throws IllegalArgumentException if the value is invalid */ public LocalDate withMonthOfYear(int monthOfYear) { return withLocalMillis(getChronology().monthOfYear().set(getLocalMillis(), monthOfYear)); }
/** * Rounds to the lowest whole unit of this field on a copy of this * LocalDate. * <p> * For example, rounding floor on the hourOfDay field of a LocalDate * where the time is 10:30 would result in new LocalDate with the * time of 10:00. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundFloorCopy() { return iInstant.withLocalMillis(iField.roundFloor(iInstant.getLocalMillis())); }
/** * Returns a copy of this date with the day of week field updated. * <p> * LocalDate is immutable, so there are no set methods. * Instead, this method returns a new instance with the value of * day of week changed. * * @param dayOfWeek the day of week to set * @return a copy of this object with the field set * @throws IllegalArgumentException if the value is invalid */ public LocalDate withDayOfWeek(int dayOfWeek) { return withLocalMillis(getChronology().dayOfWeek().set(getLocalMillis(), dayOfWeek)); }
/** * Rounds to the nearest whole unit of this field on a copy of this * LocalDate. If halfway, the ceiling is favored over the floor * only if it makes this field's value even. * * @return a copy of the LocalDate with the field value changed */ public LocalDate roundHalfEvenCopy() { return iInstant.withLocalMillis(iField.roundHalfEven(iInstant.getLocalMillis())); } }