Class StoredBundleControl
java.lang.Object
java.util.ResourceBundle.Control
org.tentackle.i18n.StoredBundleControl
- All Implemented Interfaces:
DomainContextProvider
Bundle control to use stored bundles.
Used by
Used by
StoredBundleFactory in modular apps as well as by ResourceBundle in non-modular apps.- Author:
- harald
-
Field Summary
Fields inherited from class ResourceBundle.Control
FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StoredBundle.StoredBundleUDKCreates the unique domain key to load a stored bundle.Gets the domain context.getFormats(String baseName) static booleanReturns whether properties should be tried if no stored bundle found.protected StoredResourceBundleLoads the bundle from storage.newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) static voidsetFallbackToProperties(boolean fallbackToProperties) Sets whether properties should be tried if no stored bundle found.Methods inherited from class ResourceBundle.Control
getCandidateLocales, getControl, getFallbackLocale, getNoFallbackControl, getTimeToLive, needsReload, toBundleName, toResourceNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DomainContextProvider
isWithinContext, isWithinContext, on, on, op, op
-
Constructor Details
-
StoredBundleControl
public StoredBundleControl()Creates a stored bundle control object.
-
-
Method Details
-
isFallbackToProperties
public static boolean isFallbackToProperties()Returns whether properties should be tried if no stored bundle found.- Returns:
- true if use resources from properties (default)
-
setFallbackToProperties
public static void setFallbackToProperties(boolean fallbackToProperties) Sets whether properties should be tried if no stored bundle found.- Parameters:
fallbackToProperties- true to use resources from properties, false to throwMissingResourceException
-
getDomainContext
Description copied from interface:DomainContextProviderGets the domain context.- Specified by:
getDomainContextin interfaceDomainContextProvider- Returns:
- the domain context
-
getFormats
- Overrides:
getFormatsin classResourceBundle.Control
-
newBundle
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException - Overrides:
newBundlein classResourceBundle.Control- Throws:
IllegalAccessExceptionInstantiationExceptionIOException
-
createUDK
Creates the unique domain key to load a stored bundle.- Parameters:
baseName- the base bundle name of the resource bundlelocale- the locale- Returns:
- the unique domain key
-
loadStoredBundle
Loads the bundle from storage.- Parameters:
key- the unique domain key- Returns:
- the stored resource bundle or null if no such bundle in database
-