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)
Deprecated.
|
default T |
createFrom(ChronoEntity<?> entity,
AttributeQuery attributes,
boolean lenient,
boolean preparsing)
Creates a new entity of type T based on given chronological data.
|
default T |
createFrom(TemporalAccessor threeten,
AttributeQuery attributes)
Deprecated.
Use new
bridge chronology |
T |
createFrom(TimeSource<?> clock,
AttributeQuery attributes)
Creates a new entity which reflects current time.
|
default int |
getDefaultPivotYear()
Determines the default pivot year which might be calendar specific and serves for the
formatting of two-digit-years.
|
default StartOfDay |
getDefaultStartOfDay()
Determines the default start of day.
|
default String |
getFormatPattern(DisplayStyle style,
Locale locale)
Defines a CLDR-compatible localized format pattern.
|
default 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.
|
default 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 insufficient@Deprecated T createFrom(ChronoEntity<?> entity, AttributeQuery attributes, boolean preparsing)
createFrom(ChronoEntity, AttributeQuery, boolean, boolean) insteadCreates 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 insufficientIllegalArgumentException - in any case of inconsistent dataValidationElement.ERROR_MESSAGEdefault T createFrom(ChronoEntity<?> entity, AttributeQuery attributes, boolean lenient, 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 parserlenient - controls the leniency how to interprete invalid valuespreparsing - preparsing phase active?null if given data are insufficientIllegalArgumentException - in any case of inconsistent dataValidationElement.ERROR_MESSAGEdefault 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.
context - actual chronological context to be formattedattributes - controls attributes during formattingIllegalArgumentException - in any case of inconsistent datadefault Chronology<?> preparser()
This method defines a child chronology which can preparse a chronological text.
null (default)@Deprecated default T createFrom(TemporalAccessor threeten, AttributeQuery attributes)
bridge chronologyCreates a new entity of type T based on given chronological data.
The default implementation always returns null so subclasses
with better knowledge about their own state and needs should override it.
threeten - object of type TemporalAccessorattributes - configuration attributes given by parsernull if given data are insufficientIllegalArgumentException - in any case of inconsistent datadefault String getFormatPattern(DisplayStyle style, Locale locale)
Defines a CLDR-compatible localized format pattern.
style - format stylelocale - language and country settingUnsupportedOperationException - if given style is not supported
or if no localized format pattern support is availableLocalizedPatternSupportdefault StartOfDay getDefaultStartOfDay()
Determines the default start of day.
default int getDefaultPivotYear()
Determines the default pivot year which might be calendar specific and serves for the formatting of two-digit-years.
Most calendar chronologies should choose a pivot year 20 years in the future. The standard implementation is based on the gregorian calendar.
100)Copyright © 2014–2017. All rights reserved.