public static final class TimestampFormatter.Builder extends Object
TimestampFormatter instance with configurations.| Modifier and Type | Method and Description |
|---|---|
TimestampFormatter |
build()
Builds
TimestampFormatter from the configurations. |
TimestampFormatter.Builder |
setDefaultDate(int defaultYear,
int defaultMonthOfYear,
int defaultDayOfMonth)
Sets the default date.
|
TimestampFormatter.Builder |
setDefaultDateFromString(String defaultDateString)
Sets the default date parsed from a
String. |
TimestampFormatter.Builder |
setDefaultZoneFromString(String defaultZoneString)
Sets the default timezone parsed from a
String. |
TimestampFormatter.Builder |
setDefaultZoneId(ZoneId defaultZoneId)
Sets the default
ZoneId. |
TimestampFormatter.Builder |
setDefaultZoneOffset(ZoneOffset defaultZoneOffset)
Sets the default
ZoneOffset. |
public TimestampFormatter.Builder setDefaultZoneOffset(ZoneOffset defaultZoneOffset)
ZoneOffset.defaultZoneOffset - the default ZoneOffsetpublic TimestampFormatter.Builder setDefaultZoneId(ZoneId defaultZoneId)
ZoneId.
Setting ZoneId is available only for a legacy non-prefixed matching pattern.
defaultZoneId - the default ZoneIdIllegalArgumentException - if called for a prefixed matching patternpublic TimestampFormatter.Builder setDefaultZoneFromString(String defaultZoneString)
String.
Only for a legacy non-prefixed matching pattern, the given String
is parsed into ZoneId, which accepts a geographical region such as
"America/Los_Angeles" and "Asia/Tokyo". Remember that timezones based
on geographical regions have problems, especially around daylight saving time, as
documented in LegacyDateTimeZones.
If the pattern is prefix Ruby-style or Java-style, the given String
is parsed into ZoneOffset, which is only a fixed offset. The parse is
performed with ZoneOffset.of(String).
defaultZoneString - a String to be parsed into the default timezoneIllegalArgumentException - if called for a prefixed matching patternpublic TimestampFormatter.Builder setDefaultDate(int defaultYear, int defaultMonthOfYear, int defaultDayOfMonth)
Setting a default date is available only for a legacy non-prefixed matching pattern.
If it is called for a prefixed Ruby-style or Java-style pattern, with a date which is
not 1970-01-01, it throws IllegalArgumentException.
Calling it for a prefixed pattern is intentionally accepted with 1970-01-01 for
easier migration with compatibility from Embulk's own TimestampParser.
defaultYear - the default yeardefaultMonthOfYear - the default month of a year (1-12)defaultDayOfMonth - the default day of a month (1-31)IllegalArgumentException - if called for a prefixed matching patternpublic TimestampFormatter.Builder setDefaultDateFromString(String defaultDateString)
String.
Setting a default date is available only for a legacy non-prefixed matching pattern.
If it is called for a prefixed Ruby-style or Java-style pattern, with a date which is
not 1970-01-01, it throws IllegalArgumentException.
Calling it for a prefixed pattern is intentionally accepted with 1970-01-01 for
easier migration with compatibility from Embulk's own TimestampParser.
defaultDateString - the default date in String ("YYYY-MM-DD")IllegalArgumentException - if called for a prefixed matching patternpublic TimestampFormatter build()
TimestampFormatter from the configurations.TimestampFormatter builtIllegalArgumentException - if invalid