io.vertx.uritemplate

## Interface Variables

-     public interface Variables

  Holds a set of name/value pairs where each value can be a `String` or a `List<String>` or a `Map<String, String>`.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Variables` | `addAll(JsonObject json)` Populates with a JSON object: `null` are conserved `JsonArray` is converted to `List<String>` `JsonObject` is converted to `Map<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...
    `Variables` | `clear()`
    `Object` | `get(String name)`
    `List<String>` | `getList(String name)`
    `Map<String,String>` | `getMap(String name)`
    `String` | `getSingle(String name)`
    `Set<String>` | `names()`
    `Variables` | `set(String name, List<String> value)` Set a list variable.
    `Variables` | `set(String name, Map<String,String> value)` Set a map variable.
    `Variables` | `set(String name, String value)` Set a single variable.
    `default Variables` | `setAll(JsonObject json)` Like `addAll(JsonObject)` but overwrites previous variables.
    `static Variables` | `variables()`
    `static Variables` | `variables(JsonObject json)` Create an instance populated from a JSON object: `null` are conserved `JsonArray` is converted to `List<String>` `JsonObject` is converted to `Map<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...

- - ### Method Detail

    - #### variables

          static Variables variables()

      Returns:
        an empty instance

    - #### variables

          static Variables variables(JsonObject json)

      Create an instance populated from a JSON object:
      - `null` are conserved
      - `JsonArray` is converted to `List<String>`
      - `JsonObject` is converted to `Map<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...}".
      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 name
        `value` - 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 name
        `value` - 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 name
        `value` - the variable value
      Returns:
        a reference to this, so the API can be used fluently

    - #### setAll

          default Variables setAll(JsonObject json)

      Like `addAll(JsonObject)` but overwrites previous variables.

    - #### addAll

          Variables addAll(JsonObject json)

      Populates with a JSON object:
      - `null` are conserved
      - `JsonArray` is converted to `List<String>`
      - `JsonObject` is converted to `Map<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...}".
      Parameters:
        `json` - the json that populates the returned variables
      Returns:
        a reference to this, so the API can be used fluently

    - #### clear

          Variables clear()

    - #### names

          Set<String> names()

      Returns:
        the set of variable names

    - #### get

          Object get(String name)

      Returns:
        the value of the variable `name`

    - #### getSingle

          String getSingle(String name)

      Returns:
        the single value of the variable `name`

    - #### getList

          List<String> getList(String name)

      Returns:
        the list value of the variable `name`

    - #### getMap

          Map<String,String> getMap(String name)

      Returns:
        the map value of the variable `name`

Copyright © 2022 Eclipse. All rights reserved.