Package io.rincl
Class EmptyResources
java.lang.Object
io.confound.config.AbstractConfiguration
io.confound.config.EmptyConfiguration
io.rincl.EmptyResources
- All Implemented Interfaces:
io.confound.config.Configuration
,Resources
public final class EmptyResources
extends io.confound.config.EmptyConfiguration
implements Resources
An implementation of resources that contains no definitions.
This implementation will automatically delegate to the parent resources, if any.
- Author:
- Garret Wilson
-
Field Summary
Fields inherited from class io.confound.config.EmptyConfiguration
INSTANCE
Fields inherited from interface io.confound.config.Configuration
KEY_SEGMENT_SEPARATOR, KEY_SEGMENTS_PATTERN
-
Constructor Summary
-
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.EmptyConfiguration
findBoolean, findCollection, findDouble, findInt, findLong, findObject, findPath, findSection, findString, findUri, 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
-
EmptyResources
Context class constructor.- Parameters:
contextClass
- The context with which these resources are related; usually the class of the object requesting the resource.- Throws:
NullPointerException
- if the given context class 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)
-