public abstract class AbstractNodeElement extends 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 List<NodeAttribute> |
attributes
List of attributes
|
protected List<NodeElement> |
children
List of child elements
|
protected 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,
String name,
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(Object obj) |
static List<FactoryConfigurationElement> |
getAllFactoryElements(NodeElement parent,
String name,
Collection<? extends FactoryConfiguration> factoryConfigurations)
Helper method that creates
FactoryConfigurationElement 's from a collection of FactoryConfiguration 's |
List<NodeAttribute> |
getAttributes()
List of attributes of this element
|
List<NodeElement> |
getChildElements()
Returns the list of child elements.
|
String |
getFQName()
Same as calling
NodeElement.getFQName(String) with the string "." |
String |
getFQName(String delimiter)
The fully qualified name of the element.
|
String |
getInnerContent()
The inner content of this element as string.
|
abstract 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(String content)
Sets the inner content of this element
|
void |
setOptional(boolean optional)
Sets optional or not
|
String |
toString() |
protected final List<NodeAttribute> attributes
protected final List<NodeElement> children
protected NodeElement parent
protected boolean optional
protected String innerContent
public AbstractNodeElement(NodeElement parent)
parent
- public abstract String getName()
getName
in interface NodeElement
public NodeElement getParent()
getParent
in interface NodeElement
public List<NodeAttribute> getAttributes()
getAttributes
in interface NodeElement
public 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 String getInnerContent()
getInnerContent
in interface NodeElement
public void setInnerContent(String content)
setInnerContent
in interface NodeElement
public static void addAllFactoryConfigsAsChildElements(NodeElement element, String name, 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 List<FactoryConfigurationElement> getAllFactoryElements(NodeElement parent, String name, 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 String getFQName()
NodeElement.getFQName(String)
with the string "."getFQName
in interface NodeElement
public String getFQName(String delimiter)
delimiter
stringgetFQName
in interface NodeElement
public void accept(NodeElementVisitor visitor)
NodeElementVisitor
accept
in interface NodeElement
visitor
- the visitor whose visit methods will be calledCopyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.