Package net.time4j.format
Interface TextElement<V>
- Type Parameters:
V- generic type of element values
- All Superinterfaces:
ChronoElement<V>,Comparator<ChronoDisplay>
- All Known Subinterfaces:
AdjustableTextElement<V>
A chronological element which can be formatted as text or can be parsed from a text.
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionparse(CharSequence text, ParsePosition status, AttributeQuery attributes)Interpretes the given text as element value.voidprint(ChronoDisplay context, Appendable buffer, AttributeQuery attributes)Converts the element value in given context to a formatted text.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
-
print
void print(ChronoDisplay context, Appendable buffer, AttributeQuery attributes) throws IOException, ChronoExceptionConverts the element value in given context to a formatted text.
Implementation note: The concrete element value is obtainable by the expression
context.get(this).- Parameters:
context- time context with the value of this elementbuffer- format buffer any text output will be sent toattributes- query for control attributes- Throws:
IOException- if writing to buffer failsChronoException- if there is no suitable element rule for evaluating the value
-
parse
Interpretes the given text as element value.
Implementation note: Any implementation will start first at the position
status.getIndex()and either set the new position after successful parsing or returnnullin case of error.- Parameters:
text- text to be parsedstatus- current parsing positionattributes- query for control attributes- Returns:
- parsed element value or
nullif parsing was not successful
-