Class JsonBackedConfigElement

java.lang.Object
io.nosqlbench.nb.api.config.params.JsonBackedConfigElement
All Implemented Interfaces:
ElementData

public class JsonBackedConfigElement extends Object implements ElementData
  • Constructor Details

    • JsonBackedConfigElement

      public JsonBackedConfigElement(String injectedName, com.google.gson.JsonObject jsonObject)
  • Method Details

    • get

      public Object get(String name)
      Specified by:
      get in interface ElementData
    • getKeys

      public Set<String> getKeys()
      Specified by:
      getKeys in interface ElementData
    • containsKey

      public boolean containsKey(String name)
      Specified by:
      containsKey in interface ElementData
    • getGivenName

      public String getGivenName()
      Specified by:
      getGivenName in interface ElementData
    • convert

      public <T> T convert(Object input, Class<T> type)
      Specified by:
      convert in interface ElementData
    • getAsCommon

      public Object getAsCommon(String key)
      Description copied from interface: ElementData

      Get the value for the key, but ensure that the type of value that is returned is in one of the sanctioned ElementData.COMMON_TYPES.

      If possible, the value provided should be a wrapper type around the actual backing type, such that mutability is preserved.

      If the backing type is a structured type object graph which defies direct conversion to one of the types above, then an error should be thrown.

      If the type is a collection type, then type conversion should be provided all the way down to each primitive value.

      If no value by the given name exists, the null should be returned.

      Specified by:
      getAsCommon in interface ElementData
      Parameters:
      key - The key of the value to retrieve
      Returns:
      The value as a Java primitive, Boxed primitive, or Set, List, or Map of String to Object.
    • toCommon

      public Object toCommon(Object srcValue)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • extractElementName

      public String extractElementName()
      Specified by:
      extractElementName in interface ElementData