equal
deleted
inserted
replaced
95 * <li>finding the first day of next year |
95 * <li>finding the first day of next year |
96 * <li>finding the first or last day-of-week within a month, such as "first Wednesday in June" |
96 * <li>finding the first or last day-of-week within a month, such as "first Wednesday in June" |
97 * <li>finding the next or previous day-of-week, such as "next Thursday" |
97 * <li>finding the next or previous day-of-week, such as "next Thursday" |
98 * </ul> |
98 * </ul> |
99 * |
99 * |
100 * <h3>Specification for implementors</h3> |
100 * @implSpec |
101 * This interface places no restrictions on the mutability of implementations, |
101 * This interface places no restrictions on the mutability of implementations, |
102 * however immutability is strongly recommended. |
102 * however immutability is strongly recommended. |
103 * <p> |
103 * <p> |
104 * All the implementations supplied by the static methods on this interface are immutable. |
104 * All the implementations supplied by the static methods on this interface are immutable. |
105 * |
105 * |
125 * temporal = temporal.with(thisAdjuster); |
125 * temporal = temporal.with(thisAdjuster); |
126 * </pre> |
126 * </pre> |
127 * It is recommended to use the second approach, {@code with(TemporalAdjuster)}, |
127 * It is recommended to use the second approach, {@code with(TemporalAdjuster)}, |
128 * as it is a lot clearer to read in code. |
128 * as it is a lot clearer to read in code. |
129 * |
129 * |
130 * <h3>Specification for implementors</h3> |
130 * @implSpec |
131 * The implementation must take the input object and adjust it. |
131 * The implementation must take the input object and adjust it. |
132 * The implementation defines the logic of the adjustment and is responsible for |
132 * The implementation defines the logic of the adjustment and is responsible for |
133 * documenting that logic. It may use any method on {@code Temporal} to |
133 * documenting that logic. It may use any method on {@code Temporal} to |
134 * query the temporal object and perform the adjustment. |
134 * query the temporal object and perform the adjustment. |
135 * The returned object must have the same observable type as the input object |
135 * The returned object must have the same observable type as the input object |
160 * This method allows an adjustment from {@code LocalDate} to {@code LocalDate} |
160 * This method allows an adjustment from {@code LocalDate} to {@code LocalDate} |
161 * to be wrapped to match the temporal-based interface. |
161 * to be wrapped to match the temporal-based interface. |
162 * This is provided for convenience to make user-written adjusters simpler. |
162 * This is provided for convenience to make user-written adjusters simpler. |
163 * <p> |
163 * <p> |
164 * In general, user-written adjusters should be static constants: |
164 * In general, user-written adjusters should be static constants: |
165 * <pre> |
165 * <pre>{@code |
166 * static TemporalAdjuster TWO_DAYS_LATER = TemporalAdjuster.ofDateAdjuster( |
166 * static TemporalAdjuster TWO_DAYS_LATER = TemporalAdjuster.ofDateAdjuster( |
167 * date -> date.plusDays(2)); |
167 * date -> date.plusDays(2)); |
168 * </pre> |
168 * }</pre> |
169 * |
169 * |
170 * @param dateBasedAdjuster the date-based adjuster, not null |
170 * @param dateBasedAdjuster the date-based adjuster, not null |
171 * @return the temporal adjuster wrapping on the date adjuster, not null |
171 * @return the temporal adjuster wrapping on the date adjuster, not null |
172 */ |
172 */ |
173 static TemporalAdjuster ofDateAdjuster(UnaryOperator<LocalDate> dateBasedAdjuster) { |
173 static TemporalAdjuster ofDateAdjuster(UnaryOperator<LocalDate> dateBasedAdjuster) { |