Package io.rincl
Class ChildResourcesDecorator
java.lang.Object
io.confound.config.AbstractConfiguration
io.confound.config.AbstractChildConfigurationDecorator<C>
io.confound.config.BaseChildConfigurationDecorator<Resources>
io.rincl.ChildResourcesDecorator
- All Implemented Interfaces:
io.confound.config.Configuration
,Resources
public class ChildResourcesDecorator
extends io.confound.config.BaseChildConfigurationDecorator<Resources>
implements Resources
A wrapper resources that forwards calls to the decorated resources, falling back to a parent resources.
- Author:
- Garret Wilson
-
Field Summary
Fields inherited from interface io.confound.config.Configuration
KEY_SEGMENT_SEPARATOR, KEY_SEGMENTS_PATTERN
-
Constructor Summary
ConstructorDescriptionChildResourcesDecorator
(Resources resources, Resources parentResources) Wrapped resources and parent resources constructor. -
Method Summary
Modifier and TypeMethodDescriptionfindString
(String key, Object... arguments) Retrieves a string resource that may not be present.Class<?>
Methods inherited from class io.confound.config.BaseChildConfigurationDecorator
getConfiguration, getParentConfiguration
Methods inherited from class io.confound.config.AbstractChildConfigurationDecorator
findBoolean, findCollection, findCollection, findDouble, findInt, findLong, findObject, findObject, findPath, findSection, findString, findUri, getBoolean, getCollection, getCollection, getDouble, getInt, getLong, getObject, getObject, getPath, getSection, getString, getUri, hasConfigurationValue
Methods inherited from class io.confound.config.AbstractConfiguration
or
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.confound.config.Configuration
findBoolean, findCollection, findCollection, findDouble, findInt, findLong, findObject, findObject, findPath, findSection, findString, findUri, getBoolean, getCollection, getCollection, getDouble, getInt, getLong, getObject, getObject, getPath, getSection, getString, getUri, hasConfigurationValue, requireConfiguration, resolvePath, subConfiguration, superConfiguration, withFallback
Methods inherited from interface io.rincl.Resources
createMissingConfigurationKeyException, getString, hasResource, withFallback
-
Constructor Details
-
ChildResourcesDecorator
Wrapped resources and parent resources constructor.- Parameters:
resources
- The resources to decorate.parentResources
- The parent resources to use for fallback lookup.- Throws:
NullPointerException
- if the given resources and/or parent resources isnull
.
-
-
Method Details
-
getContextClass
- Specified by:
getContextClass
in interfaceResources
- Returns:
- The context with which these resources are related; usually the class of the object requesting the resource.
-
findString
public Optional<String> findString(String key, Object... arguments) throws io.confound.config.ConfigurationException Description copied from interface:Resources
Retrieves a string resource that may not be present.TODO discuss dereferencing
If arguments are provided, the string if present will be considered a template and formatted applying the given arguments. Formatting takes place after replacement of all internal resource references. The
MessageFormat
formatting rules will be used.This method should normally not be overridden or decorated.
- Specified by:
findString
in interfaceResources
- Parameters:
key
- The resource key.arguments
- The arguments for formatting, if any.- Returns:
- The optional value of the resource associated with the given key.
- Throws:
io.confound.config.ConfigurationException
- if there is a resource value stored in an invalid format.- See Also:
-
Configuration.findString(String)
Format.format(Object)
-