org.progeeks.util.xml
Interface ObjectHandler

All Known Implementing Classes:
AbstractObjectHandler, ActionObjectHandler, AnnotationObjectHandler, BeanConfiguratorHandler, BeanObjectHandler, ChartObjectHandler, ClassRegistryHandler, ConstructedBeanHandler, DefaultObjectHandler, FileSetHandler, FormatRegistryHandler, GraphObjectHandler, JndiObjectHandler, JUnitHandler, MapObjectHandler, MetaObjectHandler, PreferencesMetaObjectHandler, StandardPredicateHandler, StringObjectHandler, SystemPropertyObjectHandler, TypeRegistryHandler

public interface ObjectHandler

Converts tags and attributes into objects and field values for the ObjectXmlReader.

Version:
$Revision: 1.7 $
Author:
Paul Speed

Method Summary
 boolean canHandle(java.lang.String tag)
          Returns true if this handler applies to the specified object tag.
 java.lang.Object createObject(java.lang.String tag, org.xml.sax.Attributes atts, ObjectXmlReader reader)
          Creates and returns an object based on the specified parameters.
 java.lang.Object getProperty(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Returns the current value of the specified property in the specified object.
 java.lang.Class getPropertyClass(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Returns the base type for the specified field.
 java.util.Collection getPropertyCollection(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Returns the a collection for the specified field that can be used to accumulate multiple object values.
 java.lang.Object resolveObject(java.lang.String tag, java.lang.Object obj, ObjectXmlReader reader)
          Converts a handler-specific internal representation of an object to a standard representation.
 void setConfigurationProperty(java.lang.String property, java.lang.String value)
          Sends a configuration property to the handler implementation.
 void setContainedText(java.lang.String tag, java.lang.Object obj, java.lang.String text, ObjectXmlReader reader)
          Called to apply any body text found during tag processing.
 void setProperty(java.lang.Object obj, java.lang.String field, java.lang.Object value, ObjectXmlReader reader)
          Sets a property on the specified object.
 void setTextProperty(java.lang.Object obj, java.lang.String field, java.lang.String value, ObjectXmlReader reader)
          Sets a text-value property on the specified object.
 

Method Detail

canHandle

boolean canHandle(java.lang.String tag)
Returns true if this handler applies to the specified object tag.


setConfigurationProperty

void setConfigurationProperty(java.lang.String property,
                              java.lang.String value)
Sends a configuration property to the handler implementation. The implementation can use it or ignore it as it sees fit.


setProperty

void setProperty(java.lang.Object obj,
                 java.lang.String field,
                 java.lang.Object value,
                 ObjectXmlReader reader)
Sets a property on the specified object.


setTextProperty

void setTextProperty(java.lang.Object obj,
                     java.lang.String field,
                     java.lang.String value,
                     ObjectXmlReader reader)
Sets a text-value property on the specified object. The handler may do some internal conversions to translate into an appropriate type.


getPropertyClass

java.lang.Class getPropertyClass(java.lang.Object obj,
                                 java.lang.String field,
                                 ObjectXmlReader reader)
Returns the base type for the specified field. This is used to determine whether or not to accumulate field values in a collection.


getPropertyCollection

java.util.Collection getPropertyCollection(java.lang.Object obj,
                                           java.lang.String field,
                                           ObjectXmlReader reader)
Returns the a collection for the specified field that can be used to accumulate multiple object values. This is used when the XML field declaration specifies the progressive attribute.


getProperty

java.lang.Object getProperty(java.lang.Object obj,
                             java.lang.String field,
                             ObjectXmlReader reader)
Returns the current value of the specified property in the specified object. This is used by the xml.existingValue directive and may eventually replace getPropertyCollection() as well.


createObject

java.lang.Object createObject(java.lang.String tag,
                              org.xml.sax.Attributes atts,
                              ObjectXmlReader reader)
Creates and returns an object based on the specified parameters.


setContainedText

void setContainedText(java.lang.String tag,
                      java.lang.Object obj,
                      java.lang.String text,
                      ObjectXmlReader reader)
Called to apply any body text found during tag processing.


resolveObject

java.lang.Object resolveObject(java.lang.String tag,
                               java.lang.Object obj,
                               ObjectXmlReader reader)
Converts a handler-specific internal representation of an object to a standard representation. This is an implementation specific thing since some handlers will collect attributes/properties in an intermediate object. When the end of the tag is reached, the ObjectXmlReader will call this method to perform and necessary translations. Handlers that don't require resolution should just return the passed object.



Copyright © 2002-2003 Paul Speed. All Rights Reserved.