Interface Config


  • public interface Config
    A root, intermediate, or leaf node in a configuration tree. Child nodes can be obtained by name using get(String). To consume the node's composite or scalar value, convert the value to the desired Java type, using one of the provided as(java.lang.Class<T>) methods.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T as​(java.lang.Class<T> type)
      Converts this node's value to the given Class.
      <T> T as​(java.lang.reflect.Type type)
      Converts this node's value to the given Type.
      <T> T as​(JavaType<T> type)
      Converts this node's value to the given JavaType.
      Config get​(java.lang.String childName)
      Returns the child node with the given unqualified name.
      java.lang.String getQualifiedName()
      The dot-separated name of this node.
      java.lang.Object getRawValue()
      The raw value of this node, as provided by Evaluator.
    • Method Detail

      • getQualifiedName

        java.lang.String getQualifiedName()
        The dot-separated name of this node. For example, the node reached using rootNode.get("foo").get("bar") has qualified name foo.bar. Returns the empty String for the root node itself.
      • getRawValue

        java.lang.Object getRawValue()
        The raw value of this node, as provided by Evaluator. Typically, a node's value is not consumed directly, but converted to the desired Java type using as(java.lang.Class<T>).
      • get

        Config get​(java.lang.String childName)
        Returns the child node with the given unqualified name.
        Throws:
        NoSuchChildException - if a child with the given name does not exist
      • as

        <T> T as​(java.lang.Class<T> type)
        Converts this node's value to the given Class.
        Throws:
        ConversionException - if the value cannot be converted to the given type
      • as

        <T> T as​(java.lang.reflect.Type type)
        Converts this node's value to the given Type.

        Note that usages of this methods are not type safe.

        Throws:
        ConversionException - if the value cannot be converted to the given type