Package io.vertx.uritemplate
Interface Variables
-
public interface VariablesHolds a set of name/value pairs where each value can be aStringor aList<String>or aMap<String, String>.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description VariablesaddAll(JsonObject json)Populates with a JSON object:nullare conservedJsonArrayis converted toList<String>JsonObjectis converted toMap<String, String>any other value is converted to a string Note that nested JSON elements are converted to a string, so { "user": { "first_name": "John", "last_name": "Doe", "address" : { "city": "Paris", etc... } } } flattens the JSON "address" to the string "{\"city\":\"Paris\",etc...}".Variablesclear()Objectget(String name)List<String>getList(String name)Map<String,String>getMap(String name)StringgetSingle(String name)Set<String>names()Variablesset(String name, String value)Set a single variable.Variablesset(String name, List<String> value)Set a list variable.Variablesset(String name, Map<String,String> value)Set a map variable.default VariablessetAll(JsonObject json)LikeaddAll(JsonObject)but overwrites previous variables.static Variablesvariables()static Variablesvariables(JsonObject json)Create an instance populated from a JSON object:nullare conservedJsonArrayis converted toList<String>JsonObjectis converted toMap<String, String>any other value is converted to a string Note that nested JSON elements are converted to a string, so { "user": { "first_name": "John", "last_name": "Doe", "address" : { "city": "Paris", etc... } } } flattens the JSON "address" to the string "{\"city\":\"Paris\",etc...}".
-
-
-
Method Detail
-
variables
static Variables variables()
- Returns:
- an empty instance
-
variables
static Variables variables(JsonObject json)
Create an instance populated from a JSON object:nullare conservedJsonArrayis converted toList<String>JsonObjectis converted toMap<String, String>- any other value is converted to a string
- Parameters:
json- the json that populates the returned variables- Returns:
- an instance populated from a JSON object
-
set
Variables set(String name, String value)
Set a single variable.- Parameters:
name- the variable namevalue- the variable value- Returns:
- a reference to this, so the API can be used fluently
-
set
Variables set(String name, List<String> value)
Set a list variable.- Parameters:
name- the variable namevalue- the variable value- Returns:
- a reference to this, so the API can be used fluently
-
set
Variables set(String name, Map<String,String> value)
Set a map variable.- Parameters:
name- the variable namevalue- the variable value- Returns:
- a reference to this, so the API can be used fluently
-
setAll
default Variables setAll(JsonObject json)
LikeaddAll(JsonObject)but overwrites previous variables.
-
addAll
Variables addAll(JsonObject json)
Populates with a JSON object:nullare conservedJsonArrayis converted toList<String>JsonObjectis converted toMap<String, String>- any other value is converted to a string
- Parameters:
json- the json that populates the returned variables- Returns:
- a reference to this, so the API can be used fluently
-
clear
Variables clear()
-
-