Package net.time4j.engine
Interface ChronoOperator<T>
- Type Parameters:
T
- generic type of entities this operator can be applied to
- All Superinterfaces:
Function<T,T>
,UnaryOperator<T>
- All Known Implementing Classes:
ElementOperator
,Month
,Quarter
,StdOperator
,Weekday
Applies a functional calculation on chronological entities and yields the result as changed copy.
Technical note: This interface is only suitable in an
Java-pre8-environment (that is Java 6 + 7) if the type T is constrained
to a final type. Otherwise the compiler will fail when compiling
expressions like entity.with(operator)
due to limited support
of type inference. This constraint does not exist with Java 8 and later.
- Author:
- Meno Hochschild
-
Method Summary
-
Method Details
-
apply
Adjusts given entity and yields a changed copy of argument.
Will be called by
ChronoEntity.with(ChronoOperator)
.- Specified by:
apply
in interfaceFunction<T,T>
- Parameters:
entity
- chronological entity to be adjusted- Returns:
- adjusted copy of argument which itself remains unaffected
- Throws:
ChronoException
- if there is no element rule for adjustingIllegalArgumentException
- if any invalid value is triedArithmeticException
- in case of numerical overflow
-