Package net.time4j.format
Interface NumericalElement<V extends Enum<V>>
- Type Parameters:
V- generic type of element values (will be adjusted to enum-supertype in next major release)
- All Superinterfaces:
ChronoElement<V>,Comparator<ChronoDisplay>
A chronological element which allows a numerical representation.
This element interface is only relevant for enum-like elements.
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionintTranslates given element value to a numerical integer.default booleanparseFromInt(ChronoEntity<?> entity, int value)Converts and stores given integer into the result buffer.default intprintToInt(V value, ChronoDisplay context, AttributeQuery attributes)Translates given element value to a numerical integer.Methods inherited from interface net.time4j.engine.ChronoElement
compare, getDefaultMaximum, getDefaultMinimum, getDisplayName, getSymbol, getType, isDateElement, isLenient, isTimeElement, nameMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
numerical
Translates given element value to a numerical integer.
Will be called by the default methods
parseFromInt(ChronoEntity, int)orprintToInt(Enum, ChronoDisplay, AttributeQuery). The integerInteger.MIN_VALUEmust be avoided in this conversion.- Parameters:
value- value to be converted to int- Returns:
- Integer-representation of given value
-
printToInt
Translates given element value to a numerical integer.
Will be called when element values need to be printed as numbers. The default implementation just delegates to
numerical(V).- Parameters:
value- value to be converted to intcontext- the object to be formattedattributes- format attributes- Returns:
- Integer-representation of given value
- Since:
- 3.37/4.32
-
parseFromInt
Converts and stores given integer into the result buffer.
Will be called when int values need to be interpreted as enums. The default implementation just delegates to
numerical(V).- Parameters:
entity- mutable result buffer for parsed valuesvalue- parsed integer- Returns:
trueif the integer can be interpreted elsefalse- Since:
- 3.37/4.32
-