org.pentaho.reporting.engine.classic.core.modules.parser.ext.factory.elements
Class AbstractElementFactory

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.modules.parser.ext.factory.elements.AbstractElementFactory
All Implemented Interfaces:
Serializable, ElementFactory
Direct Known Subclasses:
DefaultElementFactory

public class AbstractElementFactory
extends Object
implements ElementFactory

A base class for implementing the ElementFactory interface.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
AbstractElementFactory()
          Creates a new element factory.
 
Method Summary
 boolean equals(Object o)
          Compares this object with the given object for equality.
 Element getElementForType(String type)
          Returns an element for the specified type.
 int hashCode()
          Computes an hashcode for this factory.
 void registerElement(Element e)
          Registers an element.
 void registerElement(String type, Element e)
          Registers an element.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractElementFactory

public AbstractElementFactory()
Creates a new element factory.

Method Detail

registerElement

public void registerElement(Element e)
Registers an element.

Parameters:
e - the element.

registerElement

public void registerElement(String type,
                            Element e)
Registers an element.

Parameters:
type - the element type.
e - the element.

getElementForType

public Element getElementForType(String type)
Returns an element for the specified type. This implementation assumes, that all elements have a public default constructor and uses Class.newInstance() to create a new instance of that element.

Specified by:
getElementForType in interface ElementFactory
Parameters:
type - the type.
Returns:
The element.

equals

public boolean equals(Object o)
Compares this object with the given object for equality. The object will be considered equal if it is a element factory and contains the same elements.

Overrides:
equals in class Object
Parameters:
o - the object that should be compared.
Returns:
true, if the given object is equal, false otherwise.
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Computes an hashcode for this factory.

Overrides:
hashCode in class Object
Returns:
the hashcode.
See Also:
Object.hashCode()