Interface ConfigNode


public interface ConfigNode
A generic interface that represents a config file, mostly XML Please note that this is an immutable, read-only object.
  • Field Details

  • Method Details

    • name

      String name()
      Name of the tag/element.
    • attributes

      Map<String,String> attributes()
      Attributes of this node. Immutable shared instance. Not null.
    • attributesExcept

      default Map<String,String> attributesExcept(String... exclusions)
      Mutable copy of attributes(), excluding exclusions keys.
    • child

      default ConfigNode child(String name)
      Child by name
    • get

      default ConfigNode get(String name)
      Child by name or return an empty node if null. If there are multiple values, it returns the first element. This never returns a null.
    • get

      default ConfigNode get(String name, Predicate<ConfigNode> test)
    • get

      default ConfigNode get(String name, int idx)
    • childRequired

      default ConfigNode childRequired(String name, Supplier<RuntimeException> err)
    • boolVal

      default boolean boolVal(boolean def)
    • intVal

      default int intVal(int def)
    • attr

      default String attr(String name, String def)
    • attr

      default String attr(String name)
    • attrRequired

      default String attrRequired(String name, String missingErr)
      Like attr(String) but throws an error (incorporating missingErr) if not found.
    • intAttr

      default int intAttr(String name, int def)
    • boolAttr

      default boolean boolAttr(String name, boolean def)
    • txt

      default String txt(String def)
    • txt

      String txt()
    • doubleVal

      default double doubleVal(double def)
    • child

      default ConfigNode child(String name, Predicate<ConfigNode> test)
      Iterate through child nodes with the tag/element name and return the first matching
    • getAll

      default List<ConfigNode> getAll(Set<String> names, Predicate<ConfigNode> test)
      Iterate through child nodes with the names and return all the matching children
      Parameters:
      names - names of tags/elements to be returned. Null means all nodes.
      test - check for the nodes to be returned. Null means all nodes.
    • getAll

      default List<ConfigNode> getAll(String name)
      A list of all child nodes with the tag/element name.
    • exists

      default boolean exists()
    • isNull

      default boolean isNull()
    • forEachChild

      void forEachChild(Function<ConfigNode,Boolean> fun)
      abortable iterate through children
      Parameters:
      fun - consume the node and return true to continue or false to abort
    • childNodesToNamedList

      default NamedList<Object> childNodesToNamedList()