org.jfree.report.modules.parser.ext.factory.elements
Class AbstractElementFactory

java.lang.Object
  |
  +--org.jfree.report.modules.parser.ext.factory.elements.AbstractElementFactory
Direct Known Subclasses:
DefaultElementFactory

public class AbstractElementFactory
extends java.lang.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(java.lang.Object o)
          Compares this object with the given object for equality.
 Element getElementForType(java.lang.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(java.lang.String type, Element e)
          Registers an element.
 
Methods inherited from class java.lang.Object
clone, finalize, 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(java.lang.String type,
                            Element e)
Registers an element.
Parameters:
type - the element type.
e - the element.

getElementForType

public Element getElementForType(java.lang.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(java.lang.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 java.lang.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 java.lang.Object
Returns:
the hashcode.
See Also:
Object.hashCode()