Package org.elasticsearch.common.time
Class DateFormatter.MergedDateFormatter
- java.lang.Object
-
- org.elasticsearch.common.time.DateFormatter.MergedDateFormatter
-
- All Implemented Interfaces:
DateFormatter
- Enclosing interface:
- DateFormatter
public static class DateFormatter.MergedDateFormatter extends java.lang.Object implements DateFormatter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.time.DateFormatter
DateFormatter.MergedDateFormatter
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringformat(java.time.temporal.TemporalAccessor accessor)Print the supplied java time accessor in a string based representation according to this formatterjava.util.LocalegetLocale()Returns the configured locale of the date formatterjava.time.ZoneIdgetZone()Returns the configured time zone of the date formatterjava.time.temporal.TemporalAccessorparse(java.lang.String input)Try to parse input to a java time TemporalAccessorDateFormatterparseDefaulting(java.util.Map<java.time.temporal.TemporalField,java.lang.Long> fields)Configure a formatter using default fields for a TemporalAccessor that should be used in case the supplied date is not having all of those fieldsjava.lang.Stringpattern()A name based format for this formatter.DateFormatterwithLocale(java.util.Locale locale)Create a copy of this formatter that is configured to parse dates in the specified localeDateFormatterwithZone(java.time.ZoneId zoneId)Create a copy of this formatter that is configured to parse dates in the specified time zone
-
-
-
Method Detail
-
parse
public java.time.temporal.TemporalAccessor parse(java.lang.String input)
Description copied from interface:DateFormatterTry to parse input to a java time TemporalAccessor- Specified by:
parsein interfaceDateFormatter- Parameters:
input- An arbitrary string resembling the string representation of a date or time- Returns:
- The java time object containing the parsed input
-
withZone
public DateFormatter withZone(java.time.ZoneId zoneId)
Description copied from interface:DateFormatterCreate a copy of this formatter that is configured to parse dates in the specified time zone- Specified by:
withZonein interfaceDateFormatter- Parameters:
zoneId- The time zone to act on- Returns:
- A copy of the date formatter this has been called on
-
withLocale
public DateFormatter withLocale(java.util.Locale locale)
Description copied from interface:DateFormatterCreate a copy of this formatter that is configured to parse dates in the specified locale- Specified by:
withLocalein interfaceDateFormatter- Parameters:
locale- The local to use for the new formatter- Returns:
- A copy of the date formatter this has been called on
-
format
public java.lang.String format(java.time.temporal.TemporalAccessor accessor)
Description copied from interface:DateFormatterPrint the supplied java time accessor in a string based representation according to this formatter- Specified by:
formatin interfaceDateFormatter- Parameters:
accessor- The temporal accessor used to format- Returns:
- The string result for the formatting
-
pattern
public java.lang.String pattern()
Description copied from interface:DateFormatterA name based format for this formatter. Can be one of the registered formatters likeepoch_millisor a configured format likeHH:mm:ss- Specified by:
patternin interfaceDateFormatter- Returns:
- The name of this formatter
-
getLocale
public java.util.Locale getLocale()
Description copied from interface:DateFormatterReturns the configured locale of the date formatter- Specified by:
getLocalein interfaceDateFormatter- Returns:
- The locale of this formatter
-
getZone
public java.time.ZoneId getZone()
Description copied from interface:DateFormatterReturns the configured time zone of the date formatter- Specified by:
getZonein interfaceDateFormatter- Returns:
- The time zone of this formatter
-
parseDefaulting
public DateFormatter parseDefaulting(java.util.Map<java.time.temporal.TemporalField,java.lang.Long> fields)
Description copied from interface:DateFormatterConfigure a formatter using default fields for a TemporalAccessor that should be used in case the supplied date is not having all of those fields- Specified by:
parseDefaultingin interfaceDateFormatter- Parameters:
fields- AMap<TemporalField, Long>of fields to be used as fallbacks- Returns:
- A new date formatter instance, that will use those fields during parsing
-
-