org.progeeks.meta.xml
Class TypeRegistryHandler
java.lang.Object
org.progeeks.util.xml.AbstractObjectHandler
org.progeeks.util.xml.BeanObjectHandler
org.progeeks.meta.xml.TypeRegistryHandler
- All Implemented Interfaces:
- ObjectHandler
public class TypeRegistryHandler
- extends BeanObjectHandler
ObjectHandler implementation for converting XML into a
TypeRegistry implementation. Type mappings can be specified
as a list property containing the individual mappings. Convenience
tag aliases are provided for common property type keys.
If class-based entries are given the default="true" attribute then
they will be registered as base or default mappings in the registry.
- Version:
- $Revision: 1.4 $
- 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.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. |
void |
setProperty(java.lang.Object obj,
java.lang.String field,
java.lang.Object value,
ObjectXmlReader reader)
Sets a property on the specified object. |
Methods inherited from class org.progeeks.util.xml.BeanObjectHandler |
getClass, getClass, getConstant, getInnerClass, getPackages, getProperty, getTagClass, ignoreAttribute, importPackage, setConfigurationProperty, setObjectProperties, setPackages, setTextProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TAG_MAPPING
public static final java.lang.String TAG_MAPPING
- See Also:
- Constant Field Values
PROP_MAPPINGS
public static final java.lang.String PROP_MAPPINGS
- See Also:
- Constant Field Values
TypeRegistryHandler
public TypeRegistryHandler()
canHandle
public boolean canHandle(java.lang.String tag)
- Returns true if this handler applies to the specified
object tag. This attemps to turn the tag into a bean
class and then verifies that the class is a TypeRegistry
compatible class.
- Specified by:
canHandle
in interface ObjectHandler
- Overrides:
canHandle
in class BeanObjectHandler
setProperty
public void setProperty(java.lang.Object obj,
java.lang.String field,
java.lang.Object value,
ObjectXmlReader reader)
- Sets a property on the specified object.
- Specified by:
setProperty
in interface ObjectHandler
- Overrides:
setProperty
in class BeanObjectHandler
getPropertyClass
public 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.
- Specified by:
getPropertyClass
in interface ObjectHandler
- Overrides:
getPropertyClass
in class BeanObjectHandler
getPropertyCollection
public 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.
- Specified by:
getPropertyCollection
in interface ObjectHandler
- Overrides:
getPropertyCollection
in class BeanObjectHandler
createObject
public 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.
- Specified by:
createObject
in interface ObjectHandler
- Overrides:
createObject
in class BeanObjectHandler
Copyright © 2002-2003 Paul Speed. All Rights Reserved.