org.apache.commons.configuration

Class HierarchicalConfiguration.DefinedKeysVisitor

class HierarchicalConfiguration.DefinedKeysVisitor extends ConfigurationNodeVisitorAdapter

A specialized visitor that fills a list with keys that are defined in a node hierarchy.
Field Summary
SetkeyList
Stores the list to be filled.
StackparentKeys
A stack with the keys of the already processed nodes.
Constructor Summary
DefinedKeysVisitor()
Default constructor.
DefinedKeysVisitor(String prefix)
Creates a new DefinedKeysVisitor instance and sets the prefix for the keys to fetch.
Method Summary
SetgetKeyList()
Returns the list with all defined keys.
voidvisitAfterChildren(ConfigurationNode node)
Visits the node after its children has been processed.
voidvisitBeforeChildren(ConfigurationNode node)
Visits the specified node.

Field Detail

keyList

private Set keyList
Stores the list to be filled.

parentKeys

private Stack parentKeys
A stack with the keys of the already processed nodes.

Constructor Detail

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 Detail

getKeyList

public Set getKeyList()
Returns the list with all defined keys.

Returns: the list with the defined keys

visitAfterChildren

public void visitAfterChildren(ConfigurationNode node)
Visits the node after its children has been processed. Removes this node's key from the stack.

Parameters: node the node

visitBeforeChildren

public void visitBeforeChildren(ConfigurationNode node)
Visits the specified node. If this node has a value, its key is added to the internal list.

Parameters: node the node to be visited