This class provides a single wrapper to items used in the format.
| Modifier and Type | Field and Description |
|---|---|
| private final DateTimeFormatter | formatter
The formatter, not null. |
| private final TemporalAccessor | temporal
The temporal being output. |
| Access | Constructor and Description |
|---|---|
| pack-priv | DateTimePrintContext(TemporalAccessor
the temporal object being output, not null temporal, DateTimeFormatter the formatter controlling the format, not null formatter)Creates a new instance of the context. |
| Modifier and Type | Method and Description |
|---|---|
| private static TemporalAccessor | Returns: the adjusted temporal, or the original if no overrides are present in the formatterthe temporal object to adjust, not null temporal, DateTimeFormatter the formatter providing potential chronology and time-zone overrides formatter)Adjusts the given |
| private static TemporalAccessor | Returns: adjusted temporal accessor combining original fields with overridesthe original temporal object to adjust, not null temporal, ZoneId override time-zone (nullable) overrideZone, ZoneId original time-zone from temporal (nullable) temporalZone, Chronology override chronology (nullable) overrideChrono, Chronology precomputed effective chronology (override if present, otherwise temporal's chronology) effectiveChrono, Chronology original chronology from temporal (nullable) temporalChrono)Internal helper method to adjust temporal fields using override chronology and time-zone in complex cases. |
| private static TemporalAccessor | Returns: the adjusted temporal, which may be the original object if no effective changes were made, or a new object with the applied overridesthe temporal object to adjust, not null temporal, Chronology the chronology to override (null retains the original chronology) overrideChrono, ZoneId the time-zone to override (null retains the original time-zone) overrideZone)Adjusts the given |
| pack-priv DecimalStyle | |
| pack-priv Locale | |
| pack-priv TemporalAccessor | |
| pack-priv <R> R | Returns: the result, null if not found and optional is truethe query to use, not null query, boolean whether the query is optional, true if the query may be missing optional)Gets a value using a query. |
| pack-priv Long | Returns: the value, null if not found and optional is truethe field to find, not null field, boolean whether the field is optional, true if the field may be missing optional)Gets the value of the specified field. |
| public String | Returns: a string representation of the context, not nullOverrides java. Returns a string version of the context for debugging. |
| formatter | back to summary |
|---|---|
| private final DateTimeFormatter formatter The formatter, not null. | |
| temporal | back to summary |
|---|---|
| private final TemporalAccessor temporal The temporal being output. | |
| DateTimePrintContext | back to summary |
|---|---|
| pack-priv DateTimePrintContext(TemporalAccessor temporal, DateTimeFormatter formatter) Creates a new instance of the context.
| |
| adjust | back to summary |
|---|---|
| private static TemporalAccessor adjust(final TemporalAccessor temporal, DateTimeFormatter formatter) Adjusts the given
This method serves as an optimization front-end that checks for non-null overrides in the formatter.
If neither chronology nor time-zone is specified in the formatter, returns the original temporal unchanged.
Otherwise, delegates to the core adjustment method Implementation Note Optimizes for the common case where formatters don't specify chronology/time-zone by avoiding unnecessary processing. Most formatters have null for these properties.
| |
| adjustSlow | back to summary |
|---|---|
| private static TemporalAccessor adjustSlow(TemporalAccessor temporal, ZoneId overrideZone, ZoneId temporalZone, Chronology overrideChrono, Chronology effectiveChrono, Chronology temporalChrono) Internal helper method to adjust temporal fields using override chronology and time-zone in complex cases.
Handles non-instant temporal objects by creating a delegate
Implementation Note Creates an anonymous temporal accessor that:
| |
| adjustWithOverride | back to summary |
|---|---|
| private static TemporalAccessor adjustWithOverride(TemporalAccessor temporal, Chronology overrideChrono, ZoneId overrideZone) Adjusts the given
This method minimizes changes by returning the original temporal if the override parameters
are either
Implementation Note Optimizes for common cases where overrides are identical to existing values or where instant-based temporals can be directly converted with a time-zone.
| |
| getDecimalStyle | back to summary |
|---|---|
| pack-priv DecimalStyle getDecimalStyle() Gets the DecimalStyle. The DecimalStyle controls the localization of numeric output.
| |
| getLocale | back to summary |
|---|---|
| pack-priv Locale getLocale() Gets the locale. This locale is used to control localization in the format output except where localization is controlled by the DecimalStyle.
| |
| getTemporal | back to summary |
|---|---|
| pack-priv TemporalAccessor getTemporal() Gets the temporal object being output.
| |
| getValue | back to summary |
|---|---|
| pack-priv <R> R getValue(TemporalQuery<R> query, boolean optional) Gets a value using a query.
| |
| getValue | back to summary |
|---|---|
| pack-priv Long getValue(TemporalField field, boolean optional) Gets the value of the specified field. This will return the value for the specified field.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string version of the context for debugging. | |