|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.github.fge.uritemplate.vars.VariableMapBuilder
@NotThreadSafe public final class VariableMapBuilder
Builder class for a VariableMap
Use freeze() to build the variable map.
VariableMap.thaw()| Method Summary | ||
|---|---|---|
|
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 |
|
|
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 |
|
VariableMapBuilder |
addVariableMap(VariableMap other)
Add all variable definitions from another variable map |
|
VariableMap |
freeze()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public VariableMapBuilder addValue(String varname,
VariableValue value)
varname - the variable namevalue - the value, as a VariableValue
NullPointerException - either the name or the value is null
public 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 value
ScalarValue.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 iterable
ListValue.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 any
ListValue.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 map
MapValue.copyOf(Map)public VariableMapBuilder addVariableMap(VariableMap other)
other - the other variable map to copy definitions from
NullPointerException - other variable map is nullpublic VariableMap freeze()
freeze in interface com.github.fge.Thawed<VariableMap>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||