Configuration
AbstractConfiguration
, AbstractStringConfiguration
, BaseConfiguration
, EmptyConfiguration
, StringMapConfiguration
public interface Parameters
Modifier and Type | Method | Description |
---|---|---|
default boolean |
getBoolean(String key) |
Retrieves a Boolean parameter.
|
default double |
getDouble(String key) |
Retrieves a floating point parameter.
|
default int |
getInt(String key) |
Retrieves an integer parameter.
|
default int |
getLong(String key) |
Retrieves a long integer parameter.
|
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.
|
default 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<String> |
getOptionalString(String key) |
Retrieves a string parameter that may not be present.
|
Optional<URI> |
getOptionalUri(String key) |
Retrieves a URI parameter that may not be present.
|
default <T> T |
getParameter(String key) |
Retrieves a general parameter.
|
default Path |
getPath(String key) |
Retrieves a path parameter.
|
default String |
getString(String key) |
Retrieves a string parameter.
|
default URI |
getUri(String key) |
Retrieves a URI parameter.
|
boolean |
hasParameter(String key) |
Determines whether a parameter of some type exists for the given parameter key.
|
default <T> T |
requireParameter(Optional<T> parameter,
String key) |
Retrieves a required parameter from an
Optional , throwing a MissingParameterException if the parameter not present. |
default Path |
resolvePath(Path path) |
Resolves the given path as appropriate.
|
default <T> T requireParameter(@Nonnull Optional<T> parameter, @Nonnull String key) throws MissingParameterException
Optional
, throwing a MissingParameterException
if the parameter not present.
This method is primarily used to check the result of a parameter lookup call for the non-optional convenience parameter lookup versions.
T
- The type of parameter to check.parameter
- The retrieved parameter.key
- The parameter key.MissingParameterException
- if the given parameter is not present.Optional.isPresent()
boolean hasParameter(@Nonnull String key) throws ConfigurationException
key
- The parameter key.true
if a parameter of type type could be retrieved from these parameters using the given key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.@Nonnull default <T> T getParameter(@Nonnull String key) throws MissingParameterException, ConfigurationException
T
- The type of parameter expected.key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.<T> Optional<T> getOptionalParameter(@Nonnull String key) throws ConfigurationException
T
- The type of parameter expected.key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.@Nonnull default boolean getBoolean(@Nonnull String key) throws MissingParameterException, ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.Optional<Boolean> getOptionalBoolean(@Nonnull String key) throws ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.@Nonnull default double getDouble(@Nonnull String key) throws MissingParameterException, ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.Optional<Double> getOptionalDouble(@Nonnull String key) throws ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.@Nonnull default int getInt(@Nonnull String key) throws MissingParameterException, ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.Optional<Integer> getOptionalInt(@Nonnull String key) throws ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.@Nonnull default int getLong(@Nonnull String key) throws MissingParameterException, ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.default Optional<Long> getOptionalLong(@Nonnull String key) throws ConfigurationException
The default implementation delegates to getOptionalInt(String)
.
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.@Nonnull default Path getPath(@Nonnull String key) throws MissingParameterException, ConfigurationException
The path will be resolved using resolvePath(Path)
.
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.Optional<Path> getOptionalPath(@Nonnull String key) throws ConfigurationException
The path will be resolved using resolvePath(Path)
.
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.default Path resolvePath(@Nonnull Path path)
The default implementation merely returns the given path.
path
- The path to resolve.@Nonnull default String getString(@Nonnull String key) throws MissingParameterException, ConfigurationException
TODO discuss dereferencing
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.Format.format(Object)
Optional<String> getOptionalString(@Nonnull String key) throws ConfigurationException
TODO discuss dereferencing
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.Format.format(Object)
@Nonnull default URI getUri(@Nonnull String key) throws MissingParameterException, ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.MissingParameterException
- if no parameter is associated with the given key.ConfigurationException
- if there is a parameter value stored in an invalid format.Optional<URI> getOptionalUri(@Nonnull String key) throws ConfigurationException
key
- The parameter key.NullPointerException
- if the given key is null
.SecurityException
- If a security manager exists and it doesn't allow access to the specified parameter.ConfigurationException
- if there is a parameter value stored in an invalid format.Copyright © 2018 GlobalMentor, Inc.. All rights reserved.