org.oddjob.arooa.handlers
Class ValueHandler

java.lang.Object
  extended byorg.oddjob.arooa.ArooaHandler
      extended byorg.oddjob.arooa.handlers.TypicalElementHandler
          extended byorg.oddjob.arooa.handlers.ValueHandler

public class ValueHandler
extends TypicalElementHandler

This handler handles nested values. The values are created either with the class attribute or from the tag name using the Constants.VALUE_FACTORY.

The value create is added to the object being configured with a fake element tag which can be specified in the constructor. Even though the element being processed is <xyz> the addConfigured'ElementTag' method of the object currently being configured will be called with the new value.

Note that a value handler will not attempt to call the add'ElementTag' method on value creation, so the value objects created with this handler are only available to the object being configured at runtime, not parse time.

Author:
Rob Gordon.

Field Summary
static java.lang.String DEFAULT_ELEMENT_TAG
          The default tag name
 
Constructor Summary
ValueHandler()
          The default consructor.
ValueHandler(java.lang.String elementTag)
          Constructor for a hanler which
 
Method Summary
 void onStartElement(java.lang.String uri, java.lang.String tag, java.lang.String qname, org.xml.sax.Attributes attrs, ArooaContext context)
          Handles the start of an element.
 void setValueFactory(ObjectFactory valueFactory)
          Set a value factory.
 
Methods inherited from class org.oddjob.arooa.handlers.TypicalElementHandler
characters, onStartChild
 
Methods inherited from class org.oddjob.arooa.ArooaHandler
checkNamespace, onEndChild, onEndElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ELEMENT_TAG

public static final java.lang.String DEFAULT_ELEMENT_TAG
The default tag name

See Also:
Constant Field Values
Constructor Detail

ValueHandler

public ValueHandler()
The default consructor.


ValueHandler

public ValueHandler(java.lang.String elementTag)
Constructor for a hanler which

Parameters:
elementTag -
Method Detail

setValueFactory

public void setValueFactory(ObjectFactory valueFactory)
Set a value factory. This allows the value factory to be temporarily overriden for the processing of just this tag.

Parameters:
valueFactory - The ObjectFactory for creating the values.

onStartElement

public void onStartElement(java.lang.String uri,
                           java.lang.String tag,
                           java.lang.String qname,
                           org.xml.sax.Attributes attrs,
                           ArooaContext context)
                    throws org.xml.sax.SAXParseException
Description copied from class: ArooaHandler
Handles the start of an element. This base implementation does nothing.

Specified by:
onStartElement in class TypicalElementHandler
Throws:
org.xml.sax.SAXParseException