Interface IntElementRule<T>
- Type Parameters:
T
- generic type of time context compatible toChronoEntity
- All Superinterfaces:
ElementRule<T,Integer>
Element rule with support for int-primitives.
Note: All implementations must be immutable.
- Since:
- 3.15/4.12
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionint
Yields the current value of associated element in given chronological context.boolean
Queries if given value is valid for the element associated with this rule in given context.Determines the new value of the associated element in given chronological context and yields the result.Methods inherited from interface net.time4j.engine.ElementRule
getChildAtCeiling, getChildAtFloor, getMaximum, getMinimum, getValue, isValid, withValue
-
Method Details
-
getInt
Yields the current value of associated element in given chronological context.
Will be called by
ChronoEntity.getInt(ChronoElement)
.- Parameters:
context
- time context to be evaluated- Returns:
- current element value as int-primitive
- Throws:
ChronoException
- if the associated element value cannot be evaluated- Since:
- 3.15/4.12
-
isValid
Queries if given value is valid for the element associated with this rule in given context.
Will be called by
ChronoEntity.isValid(ChronoElement, int)
. A numerical overflow causing anArithmeticException
will usually not be checked.- Parameters:
context
- time context to be evaluatedvalue
- candidate value to be validated- Returns:
true
if valid elsefalse
- Since:
- 3.15/4.12
-
withValue
Determines the new value of the associated element in given chronological context and yields the result.
Will be called by
ChronoEntity.with(ChronoElement, int)
. The lenient mode causes the tolerant interpretation of invalid values like 31st of April as 1st of May. This mode is only active if an element is either explicitly declared as lenient or if the methodStdOperator.setLenient()
is used.- Parameters:
context
- time context to be evaluatedvalue
- new element valuelenient
- leniency mode- Returns:
- changed copy of context which itself remains unaffected
- Throws:
IllegalArgumentException
- if given value is out of range or not valid dependent on the given time contextArithmeticException
- in case of numerical overflow- Since:
- 3.15/4.12
- See Also:
isValid(Object, int)
,StdOperator.setLenient(Object, ChronoElement)
,ChronoElement.isLenient()
,ProportionalElement.setLenient(Number)
-