@NotThreadSafe public final class VariableMapBuilder extends Object implements Thawed<VariableMap>
VariableMap
Use freeze() to build the variable map.
VariableMap.thaw()| Modifier and Type | Method and Description |
|---|---|
<T> VariableMapBuilder |
addListValue(String varname,
Iterable<T> iterable)
Shortcut method to associate a name with a list value
|
VariableMapBuilder |
addListValue(String varname,
Object first,
Object... other)
Shortcut method to associate a name with a list value
|
<T> VariableMapBuilder |
addMapValue(String varname,
Map<String,T> map)
Shortcut method to associate a variable name to a map value
|
VariableMapBuilder |
addScalarValue(String varname,
Object value)
Shortcut method to associate a name with a scalar value
|
VariableMapBuilder |
addValue(String varname,
VariableValue value)
Associate a value to a variable name
|
VariableMap |
freeze() |
public VariableMapBuilder addValue(String varname, VariableValue value)
varname - the variable namevalue - the value, as a VariableValueNullPointerException - either the name or the value is nullpublic VariableMapBuilder addScalarValue(String varname, Object value)
The value argument can be any object, just ensure that it implements
Object.toString() correctly!
varname - the variable namevalue - the valueScalarValue.ScalarValue(Object)public <T> VariableMapBuilder addListValue(String varname, Iterable<T> iterable)
Any Iterable can be used (thereby including all collections:
sets, lists, etc). Note that it is your responsibility that objects in
this iterable implement Object.toString() correctly!
T - type of elements in the iterablevarname - the variable nameiterable - the iterableListValue.copyOf(Iterable)public VariableMapBuilder addListValue(String varname, Object first, Object... other)
This method calls Object.toString() on each element to add;
it is your responsibility to ensure that elements added implement Object.toString() correctly!
varname - the variable namefirst - first element of the list valueother - other elements of the list value, if anyListValue.of(Object, Object...)public <T> VariableMapBuilder addMapValue(String varname, Map<String,T> map)
Values of the map can be of any type. You should ensure that they
implement Object.toString() correctly!
T - type of map valuesvarname - the variable namemap - the mapMapValue.Builder.putAll(Map)public VariableMap freeze()
freeze in interface Thawed<VariableMap>Copyright © 2013. All Rights Reserved.