|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.keepondreaming.xml.MappingAnnotationStrategy
public class MappingAnnotationStrategy
Obtains informations unavailable at runtime via a configuration object Property mappings are as follows:
Date
attribute value is formated, i.e. de.keepondreaming.xml.example.Root.annotation.getEnd.dateFormatPattern=HH:mm:ss dd.MM.yyyy
Collection
s and Map
s:<interface-name>.annotation.<method name>.returnType, i.e. de.keepondreaming.xml.example.Root.annotation.getElements.returnType=de.keepondreaming.xml.example.Element
Map
:<interface-name>.annotation.<method-name>.keyAttribute i.e. de.keepondreaming.xml.example.Root.annotation.getElements.keyAttribute=string
ContentHandler.characters(char[], int, int)
:<interface-name>.annotation.content=<attribute> i.e. de.keepondreaming.xml.example.Remark.annotation.content=Remark
Constructor Summary | |
---|---|
MappingAnnotationStrategy(java.util.Properties properties)
Default constructor |
Method Summary | |
---|---|
java.lang.String |
getContentAttribute(java.lang.Class clazz,
java.lang.Object current)
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MappingAnnotationStrategy(java.util.Properties properties)
properties
- Must not be nullMethod Detail |
---|
public java.lang.String getContentAttribute(java.lang.Class clazz, java.lang.Object current)
AnnotationStrategy
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
getContentAttribute
in interface AnnotationStrategy
clazz
- Name of the current class, never nullcurrent
- The current objct processed
public java.lang.String getKeyAttribute(java.lang.reflect.Method method)
AnnotationStrategy
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">
getKeyAttribute
in interface AnnotationStrategy
method
- Method returning a Map
public java.lang.Class getGenericReturnType(java.lang.reflect.Method method)
AnnotationStrategy
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.
getGenericReturnType
in interface AnnotationStrategy
method
- Getter method returning aCollection
or Map
public java.lang.String getDateFormatPattern(java.lang.reflect.Method method)
AnnotationStrategy
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
getDateFormatPattern
in interface AnnotationStrategy
method
- Getter method returning a Date
or one of its subclasses
public void init()
AnnotationStrategy
init
in interface AnnotationStrategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |