Package org.nuiton.i18n.init
Class DefaultI18nInitializer
java.lang.Object
org.nuiton.i18n.init.I18nInitializer
org.nuiton.i18n.init.DefaultI18nInitializer
- Direct Known Subclasses:
UserI18nInitializer
public class DefaultI18nInitializer extends I18nInitializer
Default implementation of a
I18nInitializer using the default i18n
implementation (one unique bundle with a definition properties file).- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBUNDLE_DEF_ENCODINGstatic java.lang.StringBUNDLE_DEF_LOCALESstatic java.lang.StringBUNDLE_DEF_VERSIONprotected java.lang.StringbundleNamethe name of the bundle.static java.lang.StringBUNDLES_FOR_LOCALEstatic java.lang.StringDEFAULT_I18N_PATHprotected java.net.URLdefinitionURLlocation of the definition file.protected java.lang.Stringi18nPathi18n path where to seek for resources (optional).protected java.lang.ClassLoaderloaderclass loader to use (optional).static java.lang.StringUNIQUE_BUNDLE_DEFstatic java.lang.StringUNIQUE_BUNDLE_ENTRYFields inherited from class org.nuiton.i18n.init.I18nInitializer
encoding, messageFormatter, missingKeyReturnNull -
Constructor Summary
Constructors Constructor Description DefaultI18nInitializer(java.lang.String bundleName)DefaultI18nInitializer(java.lang.String bundleName, java.lang.ClassLoader loader)DefaultI18nInitializer(java.lang.String bundleName, java.lang.ClassLoader loader, java.lang.String i18nPath) -
Method Summary
Modifier and Type Method Description java.lang.StringgetBundleName()java.net.URLgetDefinitionURL()java.lang.StringgetI18nPath()java.lang.ClassLoadergetLoader()protected java.net.URLgetResourceURL(java.lang.String resource)I18nBundle[]resolvBundles()Resolv the bundles.java.lang.StringresolvDefinition(java.util.Properties properties)java.net.URL[]resolvURLs(java.lang.String prefixURL, java.util.Properties definition)protected voidsetI18nPath(java.lang.String i18nPath)protected voidsetLoader(java.lang.ClassLoader loader)Methods inherited from class org.nuiton.i18n.init.I18nInitializer
getEncoding, getMessageFormatter, isMissingKeyReturnNull, resolvBundles, setEncoding, setMessageFormatter, setMissingKeyReturnNull
-
Field Details
-
UNIQUE_BUNDLE_DEF
public static java.lang.String UNIQUE_BUNDLE_DEF -
UNIQUE_BUNDLE_ENTRY
public static java.lang.String UNIQUE_BUNDLE_ENTRY -
BUNDLE_DEF_LOCALES
public static java.lang.String BUNDLE_DEF_LOCALES -
BUNDLE_DEF_VERSION
public static java.lang.String BUNDLE_DEF_VERSION -
BUNDLE_DEF_ENCODING
public static java.lang.String BUNDLE_DEF_ENCODING -
BUNDLES_FOR_LOCALE
public static java.lang.String BUNDLES_FOR_LOCALE -
bundleName
protected final java.lang.String bundleNamethe name of the bundle. -
loader
protected java.lang.ClassLoader loaderclass loader to use (optional). -
i18nPath
protected java.lang.String i18nPathi18n path where to seek for resources (optional). -
definitionURL
protected java.net.URL definitionURLlocation of the definition file. -
DEFAULT_I18N_PATH
public static final java.lang.String DEFAULT_I18N_PATH- See Also:
- Constant Field Values
-
-
Constructor Details
-
DefaultI18nInitializer
public DefaultI18nInitializer(java.lang.String bundleName) throws java.lang.NullPointerException- Throws:
java.lang.NullPointerException
-
DefaultI18nInitializer
public DefaultI18nInitializer(java.lang.String bundleName, java.lang.ClassLoader loader) throws java.lang.NullPointerException- Throws:
java.lang.NullPointerException
-
DefaultI18nInitializer
public DefaultI18nInitializer(java.lang.String bundleName, java.lang.ClassLoader loader, java.lang.String i18nPath) throws java.lang.NullPointerException- Throws:
java.lang.NullPointerException
-
-
Method Details
-
getBundleName
public java.lang.String getBundleName() -
getLoader
public java.lang.ClassLoader getLoader() -
getI18nPath
public java.lang.String getI18nPath() -
setLoader
protected void setLoader(java.lang.ClassLoader loader) -
setI18nPath
protected void setI18nPath(java.lang.String i18nPath) -
getResourceURL
protected java.net.URL getResourceURL(java.lang.String resource) -
resolvDefinition
public java.lang.String resolvDefinition(java.util.Properties properties) throws java.lang.Exception- Throws:
java.lang.Exception
-
getDefinitionURL
public java.net.URL getDefinitionURL() throws java.lang.NullPointerException- Throws:
java.lang.NullPointerException
-
resolvURLs
public java.net.URL[] resolvURLs(java.lang.String prefixURL, java.util.Properties definition) throws java.lang.Exception- Throws:
java.lang.Exception
-
resolvBundles
Description copied from class:I18nInitializerResolv the bundles.- Specified by:
resolvBundlesin classI18nInitializer- Returns:
- the bundles detected
- Throws:
java.lang.Exception- if any pb while getting bundles
-