|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.stripes.localization.DefaultLocalizationBundleFactory
public class DefaultLocalizationBundleFactory
Very simple default implementation of a bundle factory. Looks for configuration parameters in the bootstrap properties called "LocalizationBundleFactory.ErrorMessageBundle" and "LocalizationBundleFactory.FieldNameBundle". If one or both of these values is not specified the default bundle name of "StripesResources" will be used in its place.
BootstrapPropertyResolver
Field Summary | |
---|---|
static String |
BUNDLE_NAME
The name of the default resource bundle for Stripes. |
static String |
ERROR_MESSAGE_BUNDLE
The configuration parameter for changing the default error message resource bundle. |
static String |
FIELD_NAME_BUNDLE
The configuration parameter for changing the default field name resource bundle. |
Constructor Summary | |
---|---|
DefaultLocalizationBundleFactory()
|
Method Summary | |
---|---|
protected Configuration |
getConfiguration()
|
ResourceBundle |
getErrorMessageBundle(Locale locale)
Looks for a bundle called StripesResources with the supplied locale if one is provided, or with the default locale if the locale provided is null. |
ResourceBundle |
getFormFieldBundle(Locale locale)
Looks for a bundle called StripesResources with the supplied locale if one is provided, or with the default locale if the locale provided is null. |
void |
init(Configuration configuration)
Uses the BootstrapPropertyResolver attached to the Configuration in order to look for configured bundle names in the servlet init parameters etc. |
protected void |
setConfiguration(Configuration configuration)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String BUNDLE_NAME
public static final String ERROR_MESSAGE_BUNDLE
public static final String FIELD_NAME_BUNDLE
Constructor Detail |
---|
public DefaultLocalizationBundleFactory()
Method Detail |
---|
public void init(Configuration configuration) throws Exception
init
in interface ConfigurableComponent
configuration
- the Configuration object being used by Stripes
Exception
- should be thrown if the component cannot be configured well enough to use.public ResourceBundle getErrorMessageBundle(Locale locale) throws MissingResourceException
getErrorMessageBundle
in interface LocalizationBundleFactory
locale
- an optional locale, may be null.
MissingResourceException
- if a suitable bundle cannot be foundpublic ResourceBundle getFormFieldBundle(Locale locale) throws MissingResourceException
getFormFieldBundle
in interface LocalizationBundleFactory
locale
- an optional locale, may be null.
MissingResourceException
- if a suitable bundle cannot be foundprotected Configuration getConfiguration()
protected void setConfiguration(Configuration configuration)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |