Package org.eclipse.jgit.nls
Class GlobalBundleCache
java.lang.Object
org.eclipse.jgit.nls.GlobalBundleCache
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
clear()
(package private) static <T extends TranslationBundle>
TlookupBundle
(Locale locale, Class<T> type) Looks up for a translation bundle in the global cache.
-
Field Details
-
cachedBundles
-
-
Constructor Details
-
GlobalBundleCache
GlobalBundleCache()
-
-
Method Details
-
lookupBundle
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()
-