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 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
    • fromPklBinary

      static Config fromPklBinary(byte[] bytes, ValueMapper mapper)
      Decode a config from the supplied byte array.
      Returns:
      the encoded config
    • fromPklBinary

      static Config fromPklBinary(byte[] bytes)
      Decode a config from the supplied byte array using a preconfigured ValueMapper.
      Returns:
      the encoded config
    • fromPklBinary

      static Config fromPklBinary(InputStream inputStream, ValueMapper mapper)
      Decode a config from the supplied InputStream using a preconfigured ValueMapper.
      Returns:
      the encoded config
    • fromPklBinary

      static Config fromPklBinary(InputStream inputStream)
      Decode a config from the supplied InputStream.
      Returns:
      the encoded config