Class Node
- java.lang.Object
-
- org.apache.logging.log4j.core.config.Node
-
public class Node extends java.lang.Object
A Configuration node.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>
attributes
static java.lang.String
CATEGORY
Main plugin category for plugins which are represented as a configuration node.private java.util.List<Node>
children
private java.lang.String
name
private java.lang.Object
object
private Node
parent
private PluginType<?>
type
private java.lang.String
value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>
getAttributes()
java.util.List<Node>
getChildren()
java.lang.String
getName()
<T> T
getObject()
<T> T
getObject(java.lang.Class<T> clazz)
Returns this node's object cast to the given class.Node
getParent()
PluginType<?>
getType()
java.lang.String
getValue()
boolean
hasChildren()
boolean
isInstanceOf(java.lang.Class<?> clazz)
Determines if this node's object is an instance of the given class.boolean
isRoot()
void
setObject(java.lang.Object obj)
void
setParent(Node parent)
void
setValue(java.lang.String value)
java.lang.String
toString()
-
-
-
Field Detail
-
CATEGORY
public static final java.lang.String CATEGORY
Main plugin category for plugins which are represented as a configuration node. Such plugins tend to be available as XML elements in a configuration file.- Since:
- 2.1
- See Also:
- Constant Field Values
-
parent
private Node parent
-
name
private final java.lang.String name
-
value
private java.lang.String value
-
type
private final PluginType<?> type
-
attributes
private final java.util.Map<java.lang.String,java.lang.String> attributes
-
children
private final java.util.List<Node> children
-
object
private java.lang.Object object
-
-
Constructor Detail
-
Node
public Node(Node parent, java.lang.String name, PluginType<?> type)
Creates a new instance ofNode
and initializes it with a name and the corresponding XML element.- Parameters:
parent
- the node's parent.name
- the node's name.type
- The Plugin Type associated with the node.
-
Node
public Node()
-
Node
public Node(Node node)
-
-
Method Detail
-
setParent
public void setParent(Node parent)
-
getAttributes
public java.util.Map<java.lang.String,java.lang.String> getAttributes()
-
getChildren
public java.util.List<Node> getChildren()
-
hasChildren
public boolean hasChildren()
-
getValue
public java.lang.String getValue()
-
setValue
public void setValue(java.lang.String value)
-
getParent
public Node getParent()
-
getName
public java.lang.String getName()
-
isRoot
public boolean isRoot()
-
setObject
public void setObject(java.lang.Object obj)
-
getObject
public <T> T getObject()
-
getObject
public <T> T getObject(java.lang.Class<T> clazz)
Returns this node's object cast to the given class.- Type Parameters:
T
- the type to cast to.- Parameters:
clazz
- the class to cast this node's object to.- Returns:
- this node's object.
- Since:
- 2.1
-
isInstanceOf
public boolean isInstanceOf(java.lang.Class<?> clazz)
Determines if this node's object is an instance of the given class.- Parameters:
clazz
- the class to check.- Returns:
true
if this node's object is an instance of the given class.- Since:
- 2.1
-
getType
public PluginType<?> getType()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-