Package org.eclipse.jgit.nls
Class GlobalBundleCache
- java.lang.Object
-
- org.eclipse.jgit.nls.GlobalBundleCache
-
class GlobalBundleCache extends java.lang.Object
Global cache of translation bundles.Every translation bundle will be cached here when it gets loaded for the first time from a thread. Another lookup for the same translation bundle (same locale and type) from the same or a different thread will return the cached one.
Note that NLS instances maintain per-thread Map of loaded translation bundles. Once a thread accesses a translation bundle it will keep reference to it and will not call
lookupBundle(Locale, Class)
again for the same translation bundle as long as its locale doesn't change.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.util.Locale,java.util.Map<java.lang.Class,TranslationBundle>>
cachedBundles
-
Constructor Summary
Constructors Constructor Description GlobalBundleCache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static void
clear()
(package private) static <T extends TranslationBundle>
TlookupBundle(java.util.Locale locale, java.lang.Class<T> type)
Looks up for a translation bundle in the global cache.
-
-
-
Field Detail
-
cachedBundles
private static final java.util.Map<java.util.Locale,java.util.Map<java.lang.Class,TranslationBundle>> cachedBundles
-
-
Method Detail
-
lookupBundle
static <T extends TranslationBundle> T lookupBundle(java.util.Locale locale, java.lang.Class<T> type)
Looks up for a translation bundle in the global cache. If found returns the cached bundle. If not found creates a new instance puts it into the cache and returns it.- Type Parameters:
T
- required bundle type- Parameters:
locale
- the preferred localetype
- required bundle type- Returns:
- an instance of the required bundle type
- Throws:
TranslationBundleLoadingException
- seeTranslationBundle.load(Locale)
TranslationStringMissingException
- seeTranslationBundle.load(Locale)
-
clear
static void clear()
-
-