public interface ResourceI18nConcern
extends io.csar.Concern
Once this concern is acquired, it provides access to a specific set of Resources
for some context class, e.g. the class of the instance
requesting resources.
Csar
Modifier and Type | Method and Description |
---|---|
default Class<ResourceI18nConcern> |
getConcernType() |
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.
|
default void |
setLocale(Locale locale)
Configures the locale for this concern instance for all locale categories.
|
default Class<ResourceI18nConcern> getConcernType()
getConcernType
in interface io.csar.Concern
Locale getLocale(@Nonnull Locale.Category category)
If no category has been configured for this concern instance, this method delegates to Locale.getDefault(Locale.Category)
.
category
- The category of locale to return.NullPointerException
- if the given category is null
.setLocale(Locale.Category, Locale)
,
Locale.getDefault(Locale.Category)
void setLocale(@Nonnull Locale.Category category, @Nonnull Locale locale)
getLocale(Locale.Category)
will return the value
set here.
This method does not modify the default JVM locale.
category
- The category for which the locale should be set.locale
- The new locale value.NullPointerException
- if the given category and/or new locale is null
.getLocale(Locale.Category)
default void setLocale(@Nonnull Locale locale)
getLocale(Locale.Category)
will return the value set
here.
This is a convenience method to set all locale categories.
This method does not modify the default JVM locale.
locale
- The new locale value.NullPointerException
- if the given category and/or new locale is null
.setLocale(Locale.Category, Locale)
,
getLocale(Locale.Category)
Resources getResources(@Nonnull Class<?> contextClass) throws ResourceConfigurationException
The context class returned by Resources.getContextClass()
may not necessarily be the context class provided here.
contextClass
- The context with which these resources are related; usually the class of the object requesting the resource.NullPointerException
- if the given context class is null
.ResourceConfigurationException
- if there is a configuration error.Copyright © 2016 GlobalMentor, Inc.. All rights reserved.