@API(status=EXPERIMENTAL,
since="1.3")
public class PrefixedConfigurationParameters
extends java.lang.Object
implements ConfigurationParameters
ConfigurationParameters that applies a supplied prefix to all
queries.| Modifier and Type | Field and Description |
|---|---|
private ConfigurationParameters |
delegate |
private java.lang.String |
prefix |
CONFIG_FILE_NAME| Constructor and Description |
|---|
PrefixedConfigurationParameters(ConfigurationParameters delegate,
java.lang.String prefix)
Create a new view of the supplied
ConfigurationParameters that
applies the supplied prefix to all queries. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<java.lang.String> |
get(java.lang.String key)
Get the configuration parameter stored under the specified
key. |
<T> java.util.Optional<T> |
get(java.lang.String key,
java.util.function.Function<java.lang.String,T> transformer)
Get and transform the configuration parameter stored under the specified
key using the specified transformer. |
java.util.Optional<java.lang.Boolean> |
getBoolean(java.lang.String key)
Get the boolean configuration parameter stored under the specified
key. |
private java.lang.String |
prefixed(java.lang.String key) |
int |
size()
Get the number of configuration parameters stored directly in this
ConfigurationParameters. |
private final ConfigurationParameters delegate
private final java.lang.String prefix
public PrefixedConfigurationParameters(ConfigurationParameters delegate, java.lang.String prefix)
ConfigurationParameters that
applies the supplied prefix to all queries.delegate - the ConfigurationParameters to delegate to; never
nullprefix - the prefix to apply to all queries; never null or
blankpublic java.util.Optional<java.lang.String> get(java.lang.String key)
ConfigurationParameterskey.
If no such key is present in this ConfigurationParameters,
an attempt will be made to look up the value as a JVM system property.
If no such system property exists, an attempt will be made to look up
the value in the JUnit Platform properties
file.
get in interface ConfigurationParameterskey - the key to look up; never null or blankOptional containing the value; never null
but potentially emptyConfigurationParameters.getBoolean(String),
System.getProperty(String),
ConfigurationParameters.CONFIG_FILE_NAMEpublic java.util.Optional<java.lang.Boolean> getBoolean(java.lang.String key)
ConfigurationParameterskey.
If no such key is present in this ConfigurationParameters,
an attempt will be made to look up the value as a JVM system property.
If no such system property exists, an attempt will be made to look up
the value in the JUnit Platform properties
file.
getBoolean in interface ConfigurationParameterskey - the key to look up; never null or blankOptional containing the value; never null
but potentially emptyConfigurationParameters.get(String),
Boolean.parseBoolean(String),
System.getProperty(String),
ConfigurationParameters.CONFIG_FILE_NAMEpublic <T> java.util.Optional<T> get(java.lang.String key,
java.util.function.Function<java.lang.String,T> transformer)
ConfigurationParameterskey using the specified transformer.
If no such key is present in this ConfigurationParameters,
an attempt will be made to look up the value as a JVM system property.
If no such system property exists, an attempt will be made to look up
the value in the JUnit Platform properties
file.
In case the transformer throws an exception, it will be wrapped in a
JUnitException with a helpful message.
get in interface ConfigurationParameterskey - the key to look up; never null or blanktransformer - the transformer to apply in case a value is found;
never nullOptional containing the value; never null
but potentially emptyConfigurationParameters.getBoolean(String),
System.getProperty(String),
ConfigurationParameters.CONFIG_FILE_NAMEprivate java.lang.String prefixed(java.lang.String key)
public int size()
ConfigurationParametersConfigurationParameters.size in interface ConfigurationParameters