org.inria.ns.reflex.processor
Class ClassBuilder

java.lang.Object
  extended by org.inria.ns.reflex.processor.ClassBuilder

public abstract class ClassBuilder
extends Object

Represents the builder that delivers instances for a specific QName on behalf of a module.

Usually, a builder is used to serve only one kind of class, because a QName is used for only one type of object (an active tag, a property resolver, an XPath function, or a foreign attribute) ; in this case, a concrete implementation is used to deliver just one of this objects.

However, in some rare case, the same QName is used for more than one object. In this case, a builder specific for each object is chained as a back factory, each factory chained is serving one object. A maximum of 4 concrete implementations could be chained, each overrides one of the methods mentionned below.

The following methods of this implementation does nothing, exept looking if this builder is backed by another builder. To be useful, a concrete class must override at least one of the methods :

Author:
Philippe Poulard

Constructor Summary
ClassBuilder()
           
 
Method Summary
 void addBackFactory(ClassBuilder backFactory)
          Adds a class factory used for backing this one.
 AbstractAction getActiveTag(AbstractAction parent, Element element)
          Return the action delivered by the back factory, or null.
 ForeignAttribute getForeignAttribute(String value)
          Return the foreign attribute delivered by the back factory, or null.
 PropertyResolver getPropertyResolver(QName propertyName)
          Return the predefined property delivered by the back factory, or null.
 XPathFunction getXPathFunction()
          Return the XPath function delivered by the back factory, or null.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassBuilder

public ClassBuilder()
Method Detail

addBackFactory

public void addBackFactory(ClassBuilder backFactory)
Adds a class factory used for backing this one. If a back factory is already used, it is added to it, and so on.

Parameters:
backFactory - The class factory used for backing this one.

getActiveTag

public AbstractAction getActiveTag(AbstractAction parent,
                                   Element element)
                            throws XMLException
Return the action delivered by the back factory, or null. A concrete class may override this method to deliver an instance of the action expected.

Parameters:
parent - The action depending from.
element - The element to unmarshall.
Returns:
The action delivered by the back factory, or null.
Throws:
XMLException

getPropertyResolver

public PropertyResolver getPropertyResolver(QName propertyName)
                                     throws ClassNotFoundException,
                                            InstantiationException,
                                            IllegalAccessException,
                                            XMLException
Return the predefined property delivered by the back factory, or null. A concrete class may override this method to deliver an instance of the predefined property expected.

Parameters:
propertyName - The name of the predefined property.
Returns:
The predefined property delivered by the back factory, or null.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
XMLException

getXPathFunction

public XPathFunction getXPathFunction()
                               throws ClassNotFoundException,
                                      InstantiationException,
                                      IllegalAccessException,
                                      XMLException
Return the XPath function delivered by the back factory, or null. A concrete class may override this method to deliver an instance of the XPath function expected.

Returns:
The XPath function delivered by the back factory, or null.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
XMLException

getForeignAttribute

public ForeignAttribute getForeignAttribute(String value)
                                     throws ClassNotFoundException,
                                            InstantiationException,
                                            IllegalAccessException
Return the foreign attribute delivered by the back factory, or null. A concrete class may override this method to deliver an instance of the foreign attribute expected.

Parameters:
value - The value of the foreign attribute.
Returns:
The foreign attribute delivered by the back factory, or null.
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException