public abstract class PerThreadCache
extends java.lang.Object
Uses a two-level map, initially keyed by Locale and then by a String naming a specific instance. If the requested element does not exist, a subclassing method is called to construct the object so that it can be cached.
Some algorithms were inspired by those used in the com.mousepushers.date.DateFormats class written by Mark McNamee ([email protected]) and distributed under the following license terms: Copyright (c) 2002, MousePushers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of MousePushers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT |
static java.lang.String |
USE_DEFAULT_TIMEZONE
Indicator to use timezone defaulting mechanism.
|
static java.lang.String |
USE_DEFAULT_TIMEZONE_PRE42SP6
Indicator to use timezone defaulting mechanism (in parseAsDate/parseAsTime
from pre-4.2SP6).
|
static java.lang.String |
VERSION |
Constructor and Description |
---|
PerThreadCache() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getDefaultTimeZone()
returns the name of the default timezone used for format and parse.
|
static java.util.Locale |
getLocale(int aLocaleType,
java.lang.String aFullName)
Give the programatic name of a Locale, return a Locale object
|
static java.lang.String |
getLocaleName(int aLocaleType,
java.lang.String aFullName)
Returns the name of the Locale to be used under the indicated situation.
|
static com.pega.ibm.icu.util.TimeZone |
getTimeZone(java.lang.String aKey)
Retrieve a thread-local instance of the desired TimeZone object.
|
static void |
setDefaultTimeZone(java.lang.String aName)
Sets the default timezone name used for date parsing and formatting.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
public static final java.lang.String USE_DEFAULT_TIMEZONE
public static final java.lang.String USE_DEFAULT_TIMEZONE_PRE42SP6
public static final com.pega.ibm.icu.util.TimeZone getTimeZone(java.lang.String aKey)
If the desired instance does not yet exist, the subclass will be invoked to construct the instance so that it can be inserted into the cache.
aKey
- String key to the specific instancepublic static final java.lang.String getLocaleName(int aLocaleType, java.lang.String aFullName)
aLocaleType
- use for which a Locale is neededaFullName
- provisional name of localepublic static final java.util.Locale getLocale(int aLocaleType, java.lang.String aFullName)
aLocaleType
- aFullName
- name of locale (language_country_variant)public static final java.lang.String getDefaultTimeZone()
public static final void setDefaultTimeZone(java.lang.String aName)
aName
- name of timezone to use as default during format and parseCopyright © 2015 Pegasystems Inc. All Rights Reserved.