public class EmptyResourceI18nConcern extends Object implements ResourceI18nConcern
The locale retrieval and setting methods merely delegate to the JVM defaults.
This implementation is useful for use in an unconfigured context in which all calling code provides default resources in the case of a missing resource.
EmptyResources
,
Locale.getDefault(Category)
,
Locale.setDefault(Category, Locale)
Modifier and Type | Field and Description |
---|---|
static EmptyResourceI18nConcern |
INSTANCE
Singleton instance of the resource i18n concern returning empty resources.
|
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale(Locale.Category category)
Retrieves the configured locale for the given category.
|
Resources |
getResources(Class<?> contextClass)
Retrieves resources for the given context.
|
void |
setLocale(Locale.Category category,
Locale locale)
Configures the locale for this concern instance for the given locale category.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConcernType, setLocale
public static final EmptyResourceI18nConcern INSTANCE
public Locale getLocale(Locale.Category category)
If no category has been configured for this concern instance, this method delegates to Locale.getDefault(Locale.Category)
.
This implementation delegates to Locale.getDefault(Category)
.
getLocale
in interface ResourceI18nConcern
category
- The category of locale to return.ResourceI18nConcern.setLocale(Locale.Category, Locale)
,
Locale.getDefault(Locale.Category)
public void setLocale(Locale.Category category, Locale locale)
ResourceI18nConcern.getLocale(Locale.Category)
will return the value
set here.
This method does not modify the default JVM locale.
This implementation delegates to Locale.setDefault(Category, Locale)
.
setLocale
in interface ResourceI18nConcern
category
- The category for which the locale should be set.locale
- The new locale value.ResourceI18nConcern.getLocale(Locale.Category)
public Resources getResources(Class<?> contextClass) throws ResourceConfigurationException
The context class returned by Resources.getContextClass()
may not necessarily be the context class provided here.
This implementation returns an instance of EmptyResources
.
TODO implement resources caching
getResources
in interface ResourceI18nConcern
contextClass
- The context with which these resources are related; usually the class of the object requesting the resource.ResourceConfigurationException
- if there is a configuration error.EmptyResources
Copyright © 2016 GlobalMentor, Inc.. All rights reserved.