public abstract class AbstractNodeElement extends java.lang.Object implements NodeElement
NodeElement
. Overrides equals(Object)
and hashCode()
methods by comparing the fully
qualified name of this element -- getFQName()
Modifier and Type | Field and Description |
---|---|
protected java.util.List<NodeAttribute> |
attributes
List of attributes
|
protected java.util.List<NodeElement> |
children
List of child elements
|
protected java.lang.String |
innerContent
the inner string content
|
protected boolean |
optional
Whether this element is optional
|
protected NodeElement |
parent
The parent
|
Constructor and Description |
---|
AbstractNodeElement(NodeElement parent)
Constructor accepting the parent of this element
|
Modifier and Type | Method and Description |
---|---|
void |
accept(NodeElementVisitor visitor)
Accepts an
NodeElementVisitor |
static void |
addAllFactoryConfigsAsChildElements(NodeElement element,
java.lang.String name,
java.util.Collection<? extends FactoryConfiguration> factoryConfigurations)
Helper method that adds all the
FactoryConfiguration from the parameter as child elements by creating
FactoryConfigurationElement for each of them |
void |
addAttribute(NodeAttribute attribute)
Add an attribute
|
void |
addChildElement(NodeElement childElement)
Adds a child element.
|
boolean |
equals(java.lang.Object obj) |
static java.util.List<FactoryConfigurationElement> |
getAllFactoryElements(NodeElement parent,
java.lang.String name,
java.util.Collection<? extends FactoryConfiguration> factoryConfigurations)
Helper method that creates
FactoryConfigurationElement 's from a collection of FactoryConfiguration 's |
java.util.List<NodeAttribute> |
getAttributes()
List of attributes of this element
|
java.util.List<NodeElement> |
getChildElements()
Returns the list of child elements.
|
java.lang.String |
getFQName()
Same as calling
NodeElement.getFQName(String) with the string "." |
private static java.lang.String |
getFQName(NodeElement element,
java.lang.String delimiter) |
java.lang.String |
getFQName(java.lang.String delimiter)
The fully qualified name of the element.
|
java.lang.String |
getInnerContent()
The inner content of this element as string.
|
abstract java.lang.String |
getName()
The name of the element
|
NodeElement |
getParent()
Returns the parent of this element.
|
boolean |
hasChildren()
Returns true if there is at least one child
|
int |
hashCode() |
boolean |
isOptional()
Returns true if this element is optional
|
void |
setInnerContent(java.lang.String content)
Sets the inner content of this element
|
void |
setOptional(boolean optional)
Sets optional or not
|
java.lang.String |
toString() |
protected final java.util.List<NodeAttribute> attributes
protected final java.util.List<NodeElement> children
protected NodeElement parent
protected boolean optional
protected java.lang.String innerContent
public AbstractNodeElement(NodeElement parent)
parent
- public abstract java.lang.String getName()
getName
in interface NodeElement
public NodeElement getParent()
getParent
in interface NodeElement
public java.util.List<NodeAttribute> getAttributes()
getAttributes
in interface NodeElement
public java.util.List<NodeElement> getChildElements()
getChildElements
in interface NodeElement
public void addAttribute(NodeAttribute attribute)
addAttribute
in interface NodeElement
attribute
- add an attributepublic void addChildElement(NodeElement childElement)
addChildElement
in interface NodeElement
childElement
- adds a child elementpublic boolean isOptional()
isOptional
in interface NodeElement
public void setOptional(boolean optional)
setOptional
in interface NodeElement
public boolean hasChildren()
hasChildren
in interface NodeElement
public java.lang.String getInnerContent()
getInnerContent
in interface NodeElement
public void setInnerContent(java.lang.String content)
setInnerContent
in interface NodeElement
public static void addAllFactoryConfigsAsChildElements(NodeElement element, java.lang.String name, java.util.Collection<? extends FactoryConfiguration> factoryConfigurations)
FactoryConfiguration
from the parameter as child elements by creating
FactoryConfigurationElement
for each of themelement
- the element in which the child elements will be addedname
- name to be used for the child element(s)factoryConfigurations
- the FactoryConfiguration
'spublic static java.util.List<FactoryConfigurationElement> getAllFactoryElements(NodeElement parent, java.lang.String name, java.util.Collection<? extends FactoryConfiguration> factoryConfigurations)
FactoryConfigurationElement
's from a collection of FactoryConfiguration
'sparent
- the parent for each of the create FactoryConfigurationElement
name
- name of the element(s)factoryConfigurations
- the FactoryConfiguration
'sFactoryConfigurationElement
public java.lang.String getFQName()
NodeElement.getFQName(String)
with the string "."getFQName
in interface NodeElement
public java.lang.String getFQName(java.lang.String delimiter)
delimiter
stringgetFQName
in interface NodeElement
private static java.lang.String getFQName(NodeElement element, java.lang.String delimiter)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void accept(NodeElementVisitor visitor)
NodeElementVisitor
accept
in interface NodeElement
visitor
- the visitor whose visit methods will be called