Top Description Fields Constructors Methods
net.sf.ehcache.config.generator.model

public abstract Class AbstractNodeElement

extends Object
implements NodeElement
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.config.generator.model.NodeElement
Known Direct Subclasses
net.sf.ehcache.config.generator.model.SimpleNodeElement
Imports
java.util.ArrayList, .Collection, .LinkedList, .List, net.sf.ehcache.config.FactoryConfiguration, net.sf.ehcache.config.generator.model.elements.FactoryConfigurationElement

An abstract implementation of NodeElement. Overrides equals(Object) and hashCode() methods by comparing the fully qualified name of this element -- getFQName()
Author
Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
protected final List<NodeAttribute>
attributes

List of attributes

protected final 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 Summary

AccessConstructor and Description
public
AbstractNodeElement(NodeElement parent)

Constructor accepting the parent of this element

Method Summary

Modifier and TypeMethod and Description
public void
accept(NodeElementVisitor
the visitor whose visit methods will be called
visitor
)

Implements net.sf.ehcache.config.generator.model.NodeElement.accept.

Accepts an NodeElementVisitor
public static void
addAllFactoryConfigsAsChildElements(NodeElement
the element in which the child elements will be added
element
,
String
name to be used for the child element(s)
name
,
Collection<? extends FactoryConfiguration<T extends FactoryConfiguration>> factoryConfigurations)

Helper method that adds all the FactoryConfiguration from the parameter as child elements by creating FactoryConfigurationElement for each of them

public void
addAttribute(NodeAttribute
add an attribute
attribute
)

Implements net.sf.ehcache.config.generator.model.NodeElement.addAttribute.

Add an attribute
public void
addChildElement(NodeElement
adds a child element
childElement
)

Implements net.sf.ehcache.config.generator.model.NodeElement.addChildElement.

Adds a child element.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static List<FactoryConfigurationElement>
getAllFactoryElements(NodeElement
the parent for each of the create FactoryConfigurationElement
parent
,
String
name of the element(s)
name
,
Collection<E> factoryConfigurations1)

Helper method that creates FactoryConfigurationElement's from a collection of FactoryConfiguration's

public List<NodeAttribute>
public List<NodeElement>
public String
public String
getFQName(String delimiter)

Implements net.sf.ehcache.config.generator.model.NodeElement.getFQName.

The fully qualified name of the element.
private static String
getFQName(NodeElement element, String delimiter)

public String
getInnerContent()

Implements net.sf.ehcache.config.generator.model.NodeElement.getInnerContent.

The inner content of this element as string.
public abstract String
public NodeElement
getParent()

Implements net.sf.ehcache.config.generator.model.NodeElement.getParent.

Returns the parent of this element.
public boolean
hasChildren()

Implements net.sf.ehcache.config.generator.model.NodeElement.hasChildren.

Returns true if there is at least one child
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public boolean
isOptional()

Implements net.sf.ehcache.config.generator.model.NodeElement.isOptional.

Returns true if this element is optional
public void
setInnerContent(String content)

Implements net.sf.ehcache.config.generator.model.NodeElement.setInnerContent.

Sets the inner content of this element
public void
setOptional(boolean optional)

Implements net.sf.ehcache.config.generator.model.NodeElement.setOptional.

Sets optional or not
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

attributesback to summary
protected final List<NodeAttribute> attributes

List of attributes

childrenback to summary
protected final List<NodeElement> children

List of child elements

innerContentback to summary
protected String innerContent

the inner string content

optionalback to summary
protected boolean optional

Whether this element is optional

parentback to summary
protected NodeElement parent

The parent

Constructor Detail

AbstractNodeElementback to summary
public AbstractNodeElement(NodeElement parent)

Constructor accepting the parent of this element

Method Detail

acceptback to summary
public void accept(NodeElementVisitor visitor)

Implements net.sf.ehcache.config.generator.model.NodeElement.accept.

Doc from net.sf.ehcache.config.generator.model.NodeElement.accept.

Accepts an NodeElementVisitor

Parameters
visitor:NodeElementVisitor

the visitor whose visit methods will be called

addAllFactoryConfigsAsChildElementsback to summary
public static void addAllFactoryConfigsAsChildElements(NodeElement element, String name, Collection<? extends FactoryConfiguration<T extends FactoryConfiguration>> factoryConfigurations)

Helper method that adds all the FactoryConfiguration from the parameter as child elements by creating FactoryConfigurationElement for each of them

Parameters
element:NodeElement

the element in which the child elements will be added

name:String

name to be used for the child element(s)

factoryConfigurations:Collection<? extends FactoryConfiguration<T extends FactoryConfiguration>>

the FactoryConfiguration's

addAttributeback to summary
public void addAttribute(NodeAttribute attribute)

Implements net.sf.ehcache.config.generator.model.NodeElement.addAttribute.

Doc from net.sf.ehcache.config.generator.model.NodeElement.addAttribute.

Add an attribute

Parameters
attribute:NodeAttribute

add an attribute

addChildElementback to summary
public void addChildElement(NodeElement childElement)

Implements net.sf.ehcache.config.generator.model.NodeElement.addChildElement.

Doc from net.sf.ehcache.config.generator.model.NodeElement.addChildElement.

Adds a child element.

Parameters
childElement:NodeElement

adds a child element

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAllFactoryElementsback to summary
public static List<FactoryConfigurationElement> getAllFactoryElements(NodeElement parent, String name, Collection<E> factoryConfigurations1)

Helper method that creates FactoryConfigurationElement's from a collection of FactoryConfiguration's

Parameters
parent:NodeElement

the parent for each of the create FactoryConfigurationElement

name:String

name of the element(s)

factoryConfigurations1:Collection<E>

the FactoryConfiguration's

Returns:List<FactoryConfigurationElement>

list of FactoryConfigurationElement

getAttributesback to summary
public List<NodeAttribute> getAttributes()

Implements net.sf.ehcache.config.generator.model.NodeElement.getAttributes.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getAttributes.

List of attributes of this element

Returns:List<NodeAttribute>

list of attributes of this element

getChildElementsback to summary
public List<NodeElement> getChildElements()

Implements net.sf.ehcache.config.generator.model.NodeElement.getChildElements.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getChildElements.

Returns the list of child elements.

Returns:List<NodeElement>

the list of child elements

getFQNameback to summary
public String getFQName()

Implements net.sf.ehcache.config.generator.model.NodeElement.getFQName.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getFQName.

Same as calling getFQName(String) with the string "."

Returns:String

the fully qualified name of this element

getFQNameback to summary
public String getFQName(String delimiter)

Implements net.sf.ehcache.config.generator.model.NodeElement.getFQName.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getFQName.

The fully qualified name of the element. The fully qualified name of the name is the name from the root element till this element separated by the delimiter string

Returns:String

the fully qualified name of this element separated by delimiter

getFQNameback to summary
private static String getFQName(NodeElement element, String delimiter)
getInnerContentback to summary
public String getInnerContent()

Implements net.sf.ehcache.config.generator.model.NodeElement.getInnerContent.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getInnerContent.

The inner content of this element as string. Does not include the child elements

Returns:String

inner content of this element as string. This does not include the child elements

getNameback to summary
public abstract String getName()

Redeclares net.sf.ehcache.config.generator.model.NodeElement.getName.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getName.

The name of the element

Returns:String

Name of the element

getParentback to summary
public NodeElement getParent()

Implements net.sf.ehcache.config.generator.model.NodeElement.getParent.

Doc from net.sf.ehcache.config.generator.model.NodeElement.getParent.

Returns the parent of this element. May be null.

Returns:NodeElement

parent of this element. May be null.

hasChildrenback to summary
public boolean hasChildren()

Implements net.sf.ehcache.config.generator.model.NodeElement.hasChildren.

Doc from net.sf.ehcache.config.generator.model.NodeElement.hasChildren.

Returns true if there is at least one child

Returns:boolean

true if there is at least one child, otherwise false

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isOptionalback to summary
public boolean isOptional()

Implements net.sf.ehcache.config.generator.model.NodeElement.isOptional.

Doc from net.sf.ehcache.config.generator.model.NodeElement.isOptional.

Returns true if this element is optional

Returns:boolean

true if this element is optional

setInnerContentback to summary
public void setInnerContent(String content)

Implements net.sf.ehcache.config.generator.model.NodeElement.setInnerContent.

Doc from net.sf.ehcache.config.generator.model.NodeElement.setInnerContent.

Sets the inner content of this element

setOptionalback to summary
public void setOptional(boolean optional)

Implements net.sf.ehcache.config.generator.model.NodeElement.setOptional.

Doc from net.sf.ehcache.config.generator.model.NodeElement.setOptional.

Sets optional or not

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override