- java.lang.Object
-
- java.util.ResourceBundle.Control
-
- org.tentackle.i18n.StoredBundleControl
-
- All Implemented Interfaces:
org.tentackle.pdo.DomainContextProvider
public class StoredBundleControl extends java.util.ResourceBundle.Control implements org.tentackle.pdo.DomainContextProviderBundle control to use stored bundles.
Used byStoredBundleFactoryin modular apps as well as byResourceBundlein non-modular apps.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description StoredBundleControl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StoredBundle.StoredBundleUDKcreateUDK(java.lang.String baseName, java.util.Locale locale)Creates the unique domain key to load a stored bundle.org.tentackle.pdo.DomainContextgetDomainContext()java.util.List<java.lang.String>getFormats(java.lang.String baseName)static booleanisFallbackToProperties()Returns whether properties should be tried if no stored bundle found.protected StoredResourceBundleloadStoredBundle(StoredBundle.StoredBundleUDK key)Loads the bundle from storage.java.util.ResourceBundlenewBundle(java.lang.String baseName, java.util.Locale locale, java.lang.String format, java.lang.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, toResourceName
-
-
-
-
Method Detail
-
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 if use resources from properties, false to throwMissingResourceException
-
getDomainContext
public org.tentackle.pdo.DomainContext getDomainContext()
- Specified by:
getDomainContextin interfaceorg.tentackle.pdo.DomainContextProvider
-
getFormats
public java.util.List<java.lang.String> getFormats(java.lang.String baseName)
- Overrides:
getFormatsin classjava.util.ResourceBundle.Control
-
newBundle
public java.util.ResourceBundle newBundle(java.lang.String baseName, java.util.Locale locale, java.lang.String format, java.lang.ClassLoader loader, boolean reload) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.io.IOException- Overrides:
newBundlein classjava.util.ResourceBundle.Control- Throws:
java.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionjava.io.IOException
-
createUDK
protected StoredBundle.StoredBundleUDK createUDK(java.lang.String baseName, java.util.Locale locale)
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
protected StoredResourceBundle loadStoredBundle(StoredBundle.StoredBundleUDK key)
Loads the bundle from storage.- Parameters:
key- the unique domain key- Returns:
- the stored resource bundle or null if no such bundle in database
-
-