org.progeeks.meta.xml
Class AnnotationObjectHandler
java.lang.Object
org.progeeks.util.xml.AbstractObjectHandler
org.progeeks.util.xml.BeanObjectHandler
org.progeeks.meta.xml.AnnotationObjectHandler
- All Implemented Interfaces:
- ObjectHandler
public class AnnotationObjectHandler
- extends BeanObjectHandler
ObjectHandler implementation that can be used to import
annotations associated with a MetaClass or MetaClass property.
This ObjectHandler contains its own static inner class to represent
the relationship while it is being loaded. It is then converted to
a MetaClass of type MetaObjectUtils.ANNOTATION_CLASS.
The reason this handler exists instead of having a standard bean
and using the normal handler is because it allows us to exploit the
XML format a little better for some collapsed readability.
The format is as follows:
<annotation-MyAnnotationTypeConstant key="anOptionalKey" value="the value" />
With all of the nesting options available and so forth. Because the tag itself
contains the AnnotationType reference it a) makes the start/end tags more easily
identified, and b) allows us to someday expand to allow on the fly annotation type
definition instead of requiring a constant reference.
- Version:
- $Revision: 1.3 $
- 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 |
resolveObject(java.lang.String tag,
java.lang.Object obj,
ObjectXmlReader reader)
Converts a handler-specific internal representation of an object to
a standard representation. |
Methods inherited from class org.progeeks.util.xml.BeanObjectHandler |
getClass, getClass, getConstant, getInnerClass, getPackages, getProperty, getPropertyClass, getPropertyCollection, getTagClass, ignoreAttribute, importPackage, setConfigurationProperty, setObjectProperties, setPackages, setProperty, setTextProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationObjectHandler
public AnnotationObjectHandler()
canHandle
public boolean canHandle(java.lang.String tag)
- Returns true if this handler applies to the specified
object tag.
- Specified by:
canHandle
in interface ObjectHandler
- Overrides:
canHandle
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
resolveObject
public 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.
This implementation converts our inner AnnotationMapping to a MetaObject
of the type specified by the constant MetaObjectUtils.ANNOTATION_CLASS.
- Specified by:
resolveObject
in interface ObjectHandler
- Overrides:
resolveObject
in class AbstractObjectHandler
Copyright © 2002-2003 Paul Speed. All Rights Reserved.