public interface ParameterSet extends Serializable
A ParameterSet is considered immutable, so only read methods are exposed.
Each parameter must me identified by a String name, unique within the set, and associated to a value of
any type. null values are allowed.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ParameterSet.Builder<S extends ParameterSet>
ParameterSet builder. |
| Modifier and Type | Method and Description |
|---|---|
static ParameterSet.Builder<ParameterSet> |
builder()
Builder to create a ParameterSet
|
void |
forEachParameter(BiConsumer<String,Object> action)
Performs the given action for each entry (name-value) of this parameter set.
|
default <T> Optional<T> |
getParameter(ConfigProperty<T> property)
Get the value of the parameter which name matches given
ConfigProperty key, if found. |
default <T> T |
getParameter(ConfigProperty<T> property,
T defaultValue)
Get the value of the parameter which name matches given
ConfigProperty key with default-fallback support. |
Optional<Object> |
getParameter(String name)
Get value of parameter named
name, if found. |
<T> Optional<T> |
getParameter(String name,
Class<T> type)
Get typed parameter value.
|
default <T> T |
getParameter(String name,
Class<T> type,
T defaultValue)
Get typed parameter value with default-fallback support.
|
default <T> Optional<T> |
getParameterIf(ConfigProperty<T> property,
Predicate<T> condition)
Get a (typed) parameter value only if parameter is present, has a not
null value, and its value
satisfies given condition. |
<T> Optional<T> |
getParameterIf(String name,
Class<T> type,
Predicate<T> condition)
Get a (typed) parameter value only if parameter is present, has a not
null value, and its value
satisfies given condition. |
default <T> boolean |
hasNotNullParameter(ConfigProperty<T> property)
Just like
hasParameter(ConfigProperty), check if parameter with given key is present, but returns
true only if parameter has a not null value. |
boolean |
hasNotNullParameter(String name)
Just like
hasParameter(String), check if parameter with given name is present, but returns
true only if parameter has a not null value. |
default <T> boolean |
hasParameter(ConfigProperty<T> property)
Check if a parameter is present using given
ConfigProperty property key. |
boolean |
hasParameter(String name)
Check if parameter is present using parameter
name. |
boolean |
hasParameters()
Check if some parameter is present
|
boolean hasParameters()
true if some parameter is present, false if set is empty.boolean hasParameter(String name)
name. null parameter values are allowed,
so if a parameter is present it doesn't means that it has a value.name - Parameter nametrue if parameter is present, false otherwiseboolean hasNotNullParameter(String name)
hasParameter(String), check if parameter with given name is present, but returns
true only if parameter has a not null value.name - Parameter nametrue if parameter is present and its value is not null, false otherwiseOptional<Object> getParameter(String name)
name, if found.name - Parameter name (not null)<T> Optional<T> getParameter(String name, Class<T> type)
T - Parameter value typename - Parameter name (not null)type - Expected value typedefault <T> T getParameter(String name, Class<T> type, T defaultValue)
defaultValue is returned.T - Parameter value typename - Parameter name (not null)type - Expected value typedefaultValue - Default value to return when parameter was not founddefaultValue if parameter is not present<T> Optional<T> getParameterIf(String name, Class<T> type, Predicate<T> condition)
null value, and its value
satisfies given condition.T - Parameter value typename - Parameter name (not null)type - Expected value typecondition - Condition to check (not null)conditiondefault <T> boolean hasParameter(ConfigProperty<T> property)
ConfigProperty property key. null parameter
values are allowed, so if a parameter is present it doesn't means that it has a value.T - Parameter value typeproperty - ConfigProperty to check (not null)true if parameter is present, false otherwisedefault <T> boolean hasNotNullParameter(ConfigProperty<T> property)
hasParameter(ConfigProperty), check if parameter with given key is present, but returns
true only if parameter has a not null value.T - Parameter value typeproperty - ConfigProperty to check (not null)true if parameter is present and its value is not null, false otherwisedefault <T> Optional<T> getParameter(ConfigProperty<T> property)
ConfigProperty key, if found.T - Parameter value typeproperty - ConfigProperty to get (not null)default <T> T getParameter(ConfigProperty<T> property, T defaultValue)
ConfigProperty key with default-fallback support.T - Parameter value typeproperty - ConfigProperty to get (not null)defaultValue - Default value to return when parameter was not founddefaultValue if parameter is not presentdefault <T> Optional<T> getParameterIf(ConfigProperty<T> property, Predicate<T> condition)
null value, and its value
satisfies given condition. This method uses a ConfigProperty to represent parameter name and
type.T - Parameter value typeproperty - ConfigProperty to get (not null)condition - Condition to check (not null)conditionvoid forEachParameter(BiConsumer<String,Object> action)
action - Action to perform (not null)static ParameterSet.Builder<ParameterSet> builder()
Copyright © 2017 The Holon Platform. All rights reserved.