Package nzilbb.configure
Class ParameterSet
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<String,Parameter>
-
- nzilbb.configure.ParameterSet
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,Parameter>
public class ParameterSet extends LinkedHashMap<String,Parameter>
Set of parameters, being a map to Parameters keyed on parameter name. Uses LinkedHashMap so that iteration order can be controlled, as it's insertion-order.- Author:
- Robert Fromont robert@fromont.net.nz
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description ParameterSet()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameteraddParameter(Parameter parameter)Adds a parameter to the set.ParameterSetaddParameters(Object bean)Adds parameters to this set which correspond to any fields of the class of the given object annotated asParameterFields.voidapply(Object bean)InvokesParameter.apply(Object)for all parameters in the collection.ParameterSetfromJson(javax.json.JsonArray json)Deserializes the set from a JsonArray.ParameterSetinvalidValueParameters()Returns a list ofParameters that have a collection of possible values, but the assigned value is not among them.ParameterSetparameter(Parameter parameter)Builder-pattern method for adding a parameter to the set.javax.json.JsonArraytoJson()Serializes the set as a JsonArray.ParameterSetunsetRequiredParameters()Returns a list ofParameters that are marked as required, but which have no value set.-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
addParameter
public Parameter addParameter(Parameter parameter)
Adds a parameter to the set.- Parameters:
parameter- The parameter to add.- Returns:
- The parameter added.
-
parameter
public ParameterSet parameter(Parameter parameter)
Builder-pattern method for adding a parameter to the set.- Parameters:
parameter- The parameter to add.- Returns:
- This ParameterSet.
-
apply
public void apply(Object bean)
InvokesParameter.apply(Object)for all parameters in the collection.- Parameters:
bean- The object whose bean attribute should be set.
-
addParameters
public ParameterSet addParameters(Object bean)
Adds parameters to this set which correspond to any fields of the class of the given object annotated asParameterFields.- Parameters:
bean- The object whose class may haveParameterFieldattributes.- Returns:
- A reference to this set.
-
unsetRequiredParameters
public ParameterSet unsetRequiredParameters()
Returns a list ofParameters that are marked as required, but which have no value set.- Returns:
- A possibly empty list of parameters that should have a value but don't.
-
invalidValueParameters
public ParameterSet invalidValueParameters()
Returns a list ofParameters that have a collection of possible values, but the assigned value is not among them.- Returns:
- A possibly empty list of parameters that have a value not in
Parameter.possibleValues.
-
toJson
public javax.json.JsonArray toJson()
Serializes the set as a JsonArray.- Returns:
- A JSON representation of the parameters.
-
fromJson
public ParameterSet fromJson(javax.json.JsonArray json)
Deserializes the set from a JsonArray.- Returns:
- A JSON representation of the parameters.
-
-