Interface ResourceI18nConcern
- All Superinterfaces:
io.csar.Concern
,LocaleSelectable
,ResourcesFactory
- All Known Implementing Classes:
AbstractResourceI18nConcern
,BaseResourceI18nConcern
,EmptyResourceI18nConcern
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.
- Author:
- Garret Wilson
- See Also:
-
Csar
-
Field Summary
Fields inherited from interface io.rincl.ResourcesFactory
NONE
-
Method Summary
Modifier and TypeMethodDescriptiondefault Class<ResourceI18nConcern>
default Resources
getResources
(Class<?> contextClass) Retrieves resources for the given context class.default Resources
getResources
(Object context) Retrieves resources for the given context.Methods inherited from interface io.rincl.LocaleSelectable
getLocale, setLocale, setLocale
Methods inherited from interface io.rincl.ResourcesFactory
findResources, findResources, getResources, getResources
-
Method Details
-
getConcernType
- Specified by:
getConcernType
in interfaceio.csar.Concern
-
getResources
@Nonnull default Resources getResources(@Nonnull Object context) throws io.confound.config.ConfigurationException Retrieves resources for the given context.The context class returned by
Resources.getContextClass()
may not necessarily reflect the class of the context provided here.The default implementation uses the locale returned by
LocaleSelectable.getLocale(Locale.Category)
forLocale.Category.DISPLAY
. Implementations of this interface should if at all possible implement the class-based resource lookup method variations and leave these default delegating method implementations so as to provide the most flexibility to consumers.- Parameters:
context
- The context with which these resources are related; usually the object requesting the resource.- Returns:
- Access to configured resources for the given context.
- Throws:
NullPointerException
- if the given context isnull
.io.confound.config.ConfigurationException
- if there is a configuration error.- See Also:
-
getResources
@Nonnull default Resources getResources(@Nonnull Class<?> contextClass) throws io.confound.config.ConfigurationException Retrieves resources for the given context class.The context class returned by
Resources.getContextClass()
may not necessarily be the context class provided here.The default implementation uses the locale returned by
LocaleSelectable.getLocale(Locale.Category)
forLocale.Category.DISPLAY
.- Parameters:
contextClass
- The context with which these resources are related; usually the class of the object requesting the resource.- Returns:
- Access to configured resources for the given context class.
- Throws:
NullPointerException
- if the given context class isnull
.io.confound.config.ConfigurationException
- if there is a configuration error.- See Also:
-