T - generic type of time context
(compatible to ChronoEntity)public interface ChronoMerger<T>
Merges any set of chronological informations to a new chronological entity.
This interface abstracts the knowledge of the chronology how to construct a new entity based on any set of chronological informations. It is mainly used by a parser in order to interprete textual representations of chronological entities.
Using this low-level-interface is usually reserved for Time4J and serves for internal format support. However, for constructing new calendar systems implementing this interface is an essential part for parsing support. Implementation note: All classes of this type must be immutable.
| Modifier and Type | Method and Description |
|---|---|
T |
createFrom(ChronoEntity<?> entity,
AttributeQuery attributes,
boolean preparsing)
Creates a new entity of type T based on given chronological
data.
|
T |
createFrom(TimeSource<?> clock,
AttributeQuery attributes)
Creates a new entity which reflects current time.
|
ChronoDisplay |
preformat(T context,
AttributeQuery attributes)
Transforms the current context/entity into another set of chronological
values which finally shall be formatted using given attributes.
|
Chronology<?> |
preparser()
This method defines a child chronology which can preparse
a chronological text.
|
T createFrom(TimeSource<?> clock, AttributeQuery attributes)
Creates a new entity which reflects current time.
In a date-only chronology this method will create the current date using the necessary timezone contained in given attributes.
clock - source for current timeattributes - configuration attributes which might contain
the timezone to translate current time to
local timenull if given data are insufficientT createFrom(ChronoEntity<?> entity, AttributeQuery attributes, boolean preparsing)
Creates a new entity of type T based on given chronological data.
Typically the method will query the given entity with
different priorities for elements which can compose a new chronological
entity (per group). For example a calendar date can be composed either
by epoch days or the group (year)-(month)-(day-of-month) or the group
(year)-(day-of-year) etc.
A text parser will call this method after having resolved a text
into single chronological elements and values. Implementations should
always validate the parsed values. In case of error, they are free to
either throw an IllegalArgumentException or to generate
and to save an error message by mean of the expression
entity.with(ValidationElement.ERROR_MESSAGE, message.
entity - any chronological entity like parsed
elements with their valuesattributes - configuration attributes given by parserpreparsing - preparsing phase active?null if given data are insufficientjava.lang.IllegalArgumentException - in any case of inconsistent dataValidationElement.ERROR_MESSAGEChronoDisplay preformat(T context, AttributeQuery attributes)
Transforms the current context/entity into another set of chronological values which finally shall be formatted using given attributes.
context - actual chronological context to be formattedattributes - controls attributes during formattingjava.lang.IllegalArgumentException - in any case of inconsistent dataChronology<?> preparser()
This method defines a child chronology which can preparse a chronological text.
null