S - generic type of foreign temporal typeT - generic type compatible to ChronoEntitypublic final class BridgeChronology<S,T extends ChronoEntity<T>> extends Chronology<S>
Represents a foreign chronology which delegates formatting and parsing to a chronology in Time4J.
A ChronoFormatter can be created by help of this chronology such that the formatter can be
adjusted to any foreign type without external conversion.
Important to know: This chronology does not register any elements and is also not registered itself
so Chronology.lookup(...) will inevitably fail to find this chronology.
TemporalTypeChronology.Builder<T extends ChronoEntity<T>>| Constructor and Description |
|---|
BridgeChronology(Converter<S,T> converter,
Chronology<T> delegate)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
S |
createFrom(ChronoEntity<?> entity,
AttributeQuery attributes,
boolean preparsing)
Deprecated.
|
S |
createFrom(ChronoEntity<?> entity,
AttributeQuery attributes,
boolean lenient,
boolean preparsing)
Creates a new entity of type T based on given chronological data.
|
S |
createFrom(TemporalAccessor threeten,
AttributeQuery attributes)
Creates a new entity of type T based on given chronological
data.
|
S |
createFrom(TimeSource<?> clock,
AttributeQuery attributes)
Creates a new entity which reflects current time.
|
CalendarSystem<S> |
getCalendarSystem()
Returns the associated calendar system if available.
|
CalendarSystem<S> |
getCalendarSystem(String variant)
Returns the calendar system for given calendar variant if available.
|
int |
getDefaultPivotYear()
Determines the default pivot year which might be calendar specific and serves for the
formatting of two-digit-years.
|
StartOfDay |
getDefaultStartOfDay()
Determines the default start of day.
|
List<ChronoExtension> |
getExtensions()
Returns all registered chronological extensions.
|
String |
getFormatPattern(DisplayStyle style,
Locale locale)
Not supported for foreign types.
|
Set<ChronoElement<?>> |
getRegisteredElements()
Returns all registered chronological elements.
|
boolean |
hasCalendarSystem()
Queries if this chronology has a calendar system.
|
boolean |
isSupported(ChronoElement<?> element)
This chronology does not itself support any elements.
|
ChronoDisplay |
preformat(S 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.
|
getChronoType, isRegistered, lookuppublic BridgeChronology(Converter<S,T> converter, Chronology<T> delegate)
Constructs a new instance.
converter - used in any type conversion, should be statelessdelegate - delegate chronology in Time4Jpublic S createFrom(TimeSource<?> clock, AttributeQuery attributes)
ChronoMergerCreates 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.
createFrom in interface ChronoMerger<S>createFrom in class Chronology<S>clock - source for current timeattributes - configuration attributes which might contain
the timezone to translate current time to
local timenull if given data are insufficientpublic S createFrom(TemporalAccessor threeten, AttributeQuery attributes)
ChronoMergerCreates 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.
createFrom in interface ChronoMerger<S>createFrom in class Chronology<S>threeten - object of type TemporalAccessorattributes - configuration attributes given by parsernull if given data are insufficient@Deprecated public S createFrom(ChronoEntity<?> entity, AttributeQuery attributes, boolean preparsing)
ChronoMergerCreates 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.
createFrom in interface ChronoMerger<S>createFrom in class Chronology<S>entity - any chronological entity like parsed
elements with their valuesattributes - configuration attributes given by parserpreparsing - preparsing phase active?null if given data are insufficientValidationElement.ERROR_MESSAGEpublic S createFrom(ChronoEntity<?> entity, AttributeQuery attributes, boolean lenient, boolean preparsing)
ChronoMergerCreates 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.
createFrom in interface ChronoMerger<S>createFrom in class Chronology<S>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 insufficientValidationElement.ERROR_MESSAGEpublic ChronoDisplay preformat(S context, AttributeQuery attributes)
ChronoMergerTransforms the current context/entity into another set of chronological values which finally shall be formatted using given attributes.
preformat in interface ChronoMerger<S>preformat in class Chronology<S>context - actual chronological context to be formattedattributes - controls attributes during formattingpublic Chronology<?> preparser()
ChronoMergerThis method defines a child chronology which can preparse a chronological text.
preparser in interface ChronoMerger<S>preparser in class Chronology<S>null (default)public String getFormatPattern(DisplayStyle style, Locale locale)
Not supported for foreign types.
getFormatPattern in interface ChronoMerger<S>getFormatPattern in class Chronology<S>style - format stylelocale - language and country settingUnsupportedOperationException - alwaysLocalizedPatternSupportpublic StartOfDay getDefaultStartOfDay()
ChronoMergerDetermines the default start of day.
getDefaultStartOfDay in interface ChronoMerger<S>getDefaultStartOfDay in class Chronology<S>public int getDefaultPivotYear()
ChronoMergerDetermines 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.
getDefaultPivotYear in interface ChronoMerger<S>getDefaultPivotYear in class Chronology<S>100)public boolean hasCalendarSystem()
ChronologyQueries if this chronology has a calendar system.
hasCalendarSystem in class Chronology<S>true if this chronology has a calendar system else falseChronology.getCalendarSystem()public CalendarSystem<S> getCalendarSystem()
ChronologyReturns the associated calendar system if available.
getCalendarSystem in class Chronology<S>nullChronology.hasCalendarSystem()public CalendarSystem<S> getCalendarSystem(String variant)
ChronologyReturns the calendar system for given calendar variant if available.
getCalendarSystem in class Chronology<S>variant - name of calendar variantnullCalendarVariant.getVariant()public boolean isSupported(ChronoElement<?> element)
This chronology does not itself support any elements.
Only its delegate chronology might support given element.
isSupported in class Chronology<S>element - element to be asked (optional)falsepublic Set<ChronoElement<?>> getRegisteredElements()
ChronologyReturns all registered chronological elements.
getRegisteredElements in class Chronology<S>public List<ChronoExtension> getExtensions()
ChronologyReturns all registered chronological extensions.
This method will be called by format-API in order to collect all extension elements which are relevant for formatting.
getExtensions in class Chronology<S>Copyright © 2014–2017. All rights reserved.