Class AbstractHierarchicalConfiguration.DefinedKeysVisitor

java.lang.Object
org.apache.commons.configuration2.tree.ConfigurationNodeVisitorAdapter<T>
org.apache.commons.configuration2.AbstractHierarchicalConfiguration.DefinedKeysVisitor
All Implemented Interfaces:
ConfigurationNodeVisitor<T>
Enclosing class:
AbstractHierarchicalConfiguration<T>

private class AbstractHierarchicalConfiguration.DefinedKeysVisitor extends ConfigurationNodeVisitorAdapter<T>
A specialized visitor that fills a list with keys that are defined in a node hierarchy.
  • Field Details

    • keyList

      private final Set<String> keyList
      Stores the list to be filled.
    • parentKeys

      private final Stack<String> parentKeys
      A stack with the keys of the already processed nodes.
  • Constructor Details

    • DefinedKeysVisitor

      public DefinedKeysVisitor()
      Default constructor.
    • DefinedKeysVisitor

      public DefinedKeysVisitor(String prefix)
      Creates a new DefinedKeysVisitor instance and sets the prefix for the keys to fetch.
      Parameters:
      prefix - the prefix
  • Method Details

    • getKeyList

      public Set<String> getKeyList()
      Gets the list with all defined keys.
      Returns:
      the list with the defined keys
    • visitAfterChildren

      public void visitAfterChildren(T node, NodeHandler<T> handler)
      Visits the specified node after after its children - if existing - have been processed. Empty dummy implementation of this interface method. This implementation removes this node's key from the stack.
      Specified by:
      visitAfterChildren in interface ConfigurationNodeVisitor<T>
      Overrides:
      visitAfterChildren in class ConfigurationNodeVisitorAdapter<T>
      Parameters:
      node - the node to be visited
      handler - the NodeHandler
    • visitBeforeChildren

      public void visitBeforeChildren(T node, NodeHandler<T> handler)
      Visits the specified node before the children of this node - if existing - are processed. Empty dummy implementation of this interface method. If this node has a value, its key is added to the internal list.
      Specified by:
      visitBeforeChildren in interface ConfigurationNodeVisitor<T>
      Overrides:
      visitBeforeChildren in class ConfigurationNodeVisitorAdapter<T>
      Parameters:
      node - the node to be visited
      handler - the NodeHandler
    • handleAttributeKeys

      public void handleAttributeKeys(String parentKey, T node, NodeHandler<T> handler)
      Appends all attribute keys of the current node.
      Parameters:
      parentKey - the parent key
      node - the current node
      handler - the NodeHandler