public class CalendarCache extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
CalendarCache.TimeZoneFactory
TimeZone factory from which we get timezones.
|
| Constructor and Description |
|---|
CalendarCache() |
| Modifier and Type | Method and Description |
|---|---|
static GregorianCalendar |
get(String tzId)
Return a cached GregorianCalendar object.
|
static GregorianCalendar |
get(TimeZone timezone)
Return a cached GregorianCalendar object.
|
static GregorianCalendar |
get(TimeZone timezone,
String calId)
Return a GregorianCalendar object identified by id.
|
static GregorianCalendar |
get(TimeZone timezone,
String tzId,
String calId)
Helper function.
|
static void |
setAlwaysGregorian(boolean alwaysGregorian)
Set if the the calendars produced should not observe Julian calendar
before 1582.
|
static void |
setEnabled(boolean enabled)
Enable or disable the cache
|
static void |
setProduceClones(boolean produceClones)
Configure the CalendarCache to produce clones of cached objects
(default behavior) or not.
|
static void |
setTimeZoneFactory(CalendarCache.TimeZoneFactory tzFactory)
Sets the timezone factory.
|
public static void setEnabled(boolean enabled)
enabled - true to enable cache or falsepublic static void setProduceClones(boolean produceClones)
produceClones - should it produce clones of cached objects.public static void setAlwaysGregorian(boolean alwaysGregorian)
public static void setTimeZoneFactory(CalendarCache.TimeZoneFactory tzFactory)
tzFactory - The TimeZoneFactory object to use, or null if the default
timezone factory is to be used.public static GregorianCalendar get(TimeZone timezone, String tzId, String calId)
timezone - Timezone to create the calendar in.tzId - The id of the timezone (e.g. "America/Los_Angeles")calId - Explicit ID of the calendar. Can be used e.g.
if more than one copy of the calendar for the same
timezone is needed.
Note, if specified, the caller is responsible for
making sure it's always the same timezone.public static GregorianCalendar get(TimeZone timezone, String calId)
timezone - Timezone to create the calendar incalId - Explicit ID of the calendar. Can be used e.g.
if more than one copy of the calendar for the same
timezone is needed.
Note, if specified, the caller is responsible for
making sure it's always the same timezone.public static GregorianCalendar get(TimeZone timezone)
timezone - Timezone to create the calendar inpublic static GregorianCalendar get(String tzId)
tzId - The id of the timezone (e.g. "America/Los_Angeles")Copyright © 2020. All rights reserved.