Package org.apache.commons.lang3.time
Class FastDateParser.TimeZoneStrategy
java.lang.Object
org.apache.commons.lang3.time.FastDateParser.Strategy
org.apache.commons.lang3.time.FastDateParser.PatternStrategy
org.apache.commons.lang3.time.FastDateParser.TimeZoneStrategy
- Enclosing class:
- FastDateParser
A strategy that handles a time zone field in the parsing pattern
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final intIndex of zone id fromDateFormatSymbols.getZoneStrings().private static final StringSame asRFC_822_TIME_ZONEbut also accepts the ISO 8601 extended form"+hh:mm".private static final ConcurrentMap<Locale,FastDateParser.Strategy> Cache ofFastDateParser.TimeZoneStrategyinstances that accept the ISO 8601 extended form, keyed by locale.private final Localeprivate static final Stringprivate final Map<String,FastDateParser.TimeZoneStrategy.TzInfo> Using lower case only or upper case only will cause problems with some Locales like Turkey, Armenia, Colognian and also depending on the Java version.Fields inherited from class org.apache.commons.lang3.time.FastDateParser.PatternStrategy
pattern -
Constructor Summary
ConstructorsConstructorDescriptionTimeZoneStrategy(Locale locale, boolean iso8601Extended) Constructs a Strategy that parses a TimeZone. -
Method Summary
Modifier and TypeMethodDescription(package private) static void(package private) static FastDateParser.StrategygetIsoExtendedStrategy(Locale locale) Gets aFastDateParser.TimeZoneStrategythat also parses the ISO 8601 extended offset form"+hh:mm".(package private) voidsetCalendar(FastDateParser parser, Calendar calendar, String timeZone) (package private) static booleanskipTimeZone(String tzId) Tests whether to skip the given time zone, true if TimeZone.getTimeZone().toString()Converts this instance to a handy debug string.Methods inherited from class org.apache.commons.lang3.time.FastDateParser.PatternStrategy
createPattern, createPattern, isNumber, parse
-
Field Details
-
RFC_822_TIME_ZONE
- See Also:
-
ISO_8601_EXTENDED_TIME_ZONE
Same asRFC_822_TIME_ZONEbut also accepts the ISO 8601 extended form"+hh:mm".- See Also:
-
ISO_EXTENDED_ZONE_CACHE
Cache ofFastDateParser.TimeZoneStrategyinstances that accept the ISO 8601 extended form, keyed by locale. Kept separate from the field caches because 'z' (and 'Z' with a single letter) must keep exact SimpleDateFormat parity and reject the extended form. -
GMT_OPTION
- See Also:
-
ID
private static final int IDIndex of zone id fromDateFormatSymbols.getZoneStrings().- See Also:
-
locale
-
tzNames
Using lower case only or upper case only will cause problems with some Locales like Turkey, Armenia, Colognian and also depending on the Java version. For details, see https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/
-
-
Constructor Details
-
TimeZoneStrategy
TimeZoneStrategy(Locale locale, boolean iso8601Extended) Constructs a Strategy that parses a TimeZone.- Parameters:
locale- The Locale.iso8601Extended- Whether to also accept the ISO 8601 extended offset form"+hh:mm"that FastDatePrinter emits for three or more 'Z' pattern letters.
-
-
Method Details
-
clearIsoExtendedCache
static void clearIsoExtendedCache() -
getIsoExtendedStrategy
Gets aFastDateParser.TimeZoneStrategythat also parses the ISO 8601 extended offset form"+hh:mm".- Parameters:
locale- The Locale.- Returns:
- A shared strategy instance for the given Locale.
-
skipTimeZone
Tests whether to skip the given time zone, true if TimeZone.getTimeZone().On Java 25 and up, skips short IDs if
ignoreTimeZoneShortIDsis true.This method is package private only for testing.
- Parameters:
tzId- The ID to test.- Returns:
- Whether to skip the given time zone ID.
-
setCalendar
- Specified by:
setCalendarin classFastDateParser.PatternStrategy
-
toString
Converts this instance to a handy debug string.- Overrides:
toStringin classFastDateParser.PatternStrategy- Since:
- 3.12.0
-