de.keepondreaming.xml
Interface AnnotationStrategy

All Known Implementing Classes:
JavaAnnotationsStrategy, MappingAnnotationStrategy

public interface AnnotationStrategy

Instances of this class provide a XmlConverter with lookup methods to receive metadata information not obtainable by runtime class information $Author: wintermond $ $Date: 2005/07/10 18:38:07 $ $Log: AnnotationStrategy.java,v $ Revision 1.1 2005/07/10 18:38:07 wintermond Renamed ParserStrategy to AnnotationStrategy Added support to annotate date format patterns Revision 1.3 2005/07/09 09:58:29 wintermond javadoc


Method Summary
 java.lang.String getContentAttribute(java.lang.Class clazz, java.lang.Object object)
          This method is called whenever the XmlConverter wants to set contents read by the ContentHandler.characters(char[], int, int)-method.
 java.lang.String getDateFormatPattern(java.lang.reflect.Method method)
          This method is called whenever the XmlConverter reads a String for a method returning a Date or one of its subclasses.
 java.lang.Class getGenericReturnType(java.lang.reflect.Method method)
          This method is called whenever the XmlConverter wants to set the contents of a Collection- or Map-return type.
 java.lang.String getKeyAttribute(java.lang.reflect.Method method)
          Called by the XmlConverter if an entry has to be set in a Map.
 void init()
          Restore initial state
 

Method Detail

getContentAttribute

java.lang.String getContentAttribute(java.lang.Class clazz,
                                     java.lang.Object object)
This method is called whenever the XmlConverter wants to set contents read by the ContentHandler.characters(char[], int, int)-method. The XmlConverter needs the attribute name designated for the content to lookup the corresponding setter method.

clazz is guaranteed to be not null

Parameters:
clazz - Name of the current class, never null
object - The current objct processed
Returns:
The name of the method set receives the untagged contents

getKeyAttribute

java.lang.String getKeyAttribute(java.lang.reflect.Method method)
Called by the XmlConverter if an entry has to be set in a Map.

The name of the attribute containing the key identifier gets returned.

Note: At the moment the key attribute must be of type String and the attribute must be read as an attribute, not as a sub tag!

This means that

<myTag><myKeyAttribute>myKeyValue</myKeyAttribute></myTag> will not work, use instead

<myTag myKeyAttribute="myKeyValue">

Parameters:
method - Method returning a Map
Returns:
The attribute name of the Class storing the key-value

getGenericReturnType

java.lang.Class getGenericReturnType(java.lang.reflect.Method method)
This method is called whenever the XmlConverter wants to set the contents of a Collection- or Map-return type.

The method returns the base class all stored elements must be assignable to.

Note that the ProxyObjectStrategy requires the returned class types to be interfaces.

Parameters:
method - Getter method returning aCollection or Map
Returns:
An class of the element classes stored within.

getDateFormatPattern

java.lang.String getDateFormatPattern(java.lang.reflect.Method method)
This method is called whenever the XmlConverter reads a String for a method returning a Date or one of its subclasses. Values can be either longs or formatted strings, which have to be converted to longs.

This method returns the formatting string, or null if values are expected as longs

Parameters:
method - Getter method returning a Date or one of its subclasses
Returns:
A Date format string or null

init

void init()
Restore initial state



Copyright © -2005 . All Rights Reserved.