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

    Modifier and Type
    Method
    Description
    <T> T
    as(Class<T> type)
    Converts this node's value to the given Class.
    <T> T
    as(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.
    get(String childName)
    Returns the child node with the given unqualified name.
    The dot-separated name of this node.
    The raw value of this node, as provided by Evaluator.
  • Method Details

    • getQualifiedName

      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

      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(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(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(Type type)
      Converts this node's value to the given Type.

      Note that usages of this method are not type safe.

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

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