Configuration
, Parameters
StringMapConfiguration
public abstract class AbstractStringConfiguration extends BaseConfiguration
This class retrieves all parameters as stored in string format based upon BaseConfiguration.getOptionalStringImpl(String)
.
Constructor | Description |
---|---|
AbstractStringConfiguration(Optional<Configuration> parentConfiguration) |
Parent configuration constructor.
|
Modifier and Type | Method | Description |
---|---|---|
Optional<Boolean> |
getOptionalBoolean(String key) |
Retrieves a Boolean parameter that may not be present.
|
Optional<Double> |
getOptionalDouble(String key) |
Retrieves a floating point parameter that may not be present.
|
Optional<Integer> |
getOptionalInt(String key) |
Retrieves an integer parameter that may not be present.
|
Optional<Long> |
getOptionalLong(String key) |
Retrieves a long integer parameter that may not be present.
|
<T> Optional<T> |
getOptionalParameter(String key) |
Retrieves a general parameter that may not be present.
|
Optional<Path> |
getOptionalPath(String key) |
Retrieves a path parameter that may not be present.
|
Optional<URI> |
getOptionalUri(String key) |
Retrieves a URI parameter that may not be present.
|
boolean |
hasParameter(String key) |
Determines whether a parameter of some type exists for the given parameter key.
|
getParentConfiguration, or
dereferenceString, getOptionalDereferencedString, getOptionalString, getOptionalStringImpl, normalizeKey
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBoolean, getDouble, getInt, getLong, getParameter, getPath, getString, getUri, requireParameter, resolvePath
public AbstractStringConfiguration(@Nonnull Optional<Configuration> parentConfiguration)
parentConfiguration
- The parent configuration for fallback lookup.NullPointerException
- if the given parent configuration is null
.public boolean hasParameter(@Nonnull String key) throws ConfigurationException
This method searches the parent configuration hierarchy if no parameter is available in this instance.
This implementation delegates to BaseConfiguration.getOptionalStringImpl(String)
.
key
- The parameter key.true
if a parameter of type type could be retrieved from these parameters using the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.public <T> Optional<T> getOptionalParameter(String key) throws ConfigurationException
This implementation delegates to BaseConfiguration.getOptionalDereferencedString(String)
.
T
- The type of parameter expected.key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.public Optional<Boolean> getOptionalBoolean(String key) throws ConfigurationException
This implementation parses the value using Boolean.valueOf(String)
.
key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.public Optional<Double> getOptionalDouble(String key) throws ConfigurationException
This implementation parses the value using Double.valueOf(String)
.
key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.public Optional<Integer> getOptionalInt(String key) throws ConfigurationException
This implementation parses the value using Integer.valueOf(String)
.
key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.public Optional<Long> getOptionalLong(String key) throws ConfigurationException
The default implementation delegates to Parameters.getOptionalInt(String)
.
This implementation parses the value using Long.valueOf(long)
.
key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.public Optional<Path> getOptionalPath(String key) throws ConfigurationException
The path will be resolved using Parameters.resolvePath(Path)
.
This implementation parses the value using URI.create(String)
and then resolves the path using Parameters.resolvePath(Path)
.
key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.public Optional<URI> getOptionalUri(String key) throws ConfigurationException
This implementation parses the value using URI.create(String)
.
key
- The parameter key.ConfigurationException
- if there is a parameter value stored in an invalid format.Copyright © 2018 GlobalMentor, Inc.. All rights reserved.