java.lang.Object
java.util.ResourceBundle.Control
org.tentackle.i18n.StoredBundleControl
- All Implemented Interfaces:
org.tentackle.pdo.DomainContextProvider
public class StoredBundleControl
extends ResourceBundle.Control
implements org.tentackle.pdo.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 java.util.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.org.tentackle.pdo.DomainContextgetFormats(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 java.util.ResourceBundle.Control
getCandidateLocales, getControl, getFallbackLocale, getNoFallbackControl, getTimeToLive, needsReload, toBundleName, toResourceNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tentackle.pdo.DomainContextProvider
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
public org.tentackle.pdo.DomainContext getDomainContext()- Specified by:
getDomainContextin interfaceorg.tentackle.pdo.DomainContextProvider
-
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
-