|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork.util.DefaultObjectTypeDeterminer
com.opensymphony.xwork.util.GenericsObjectTypeDeterminer
public class GenericsObjectTypeDeterminer
GenericsObjectTypeDeterminer use the following algorithm for determining the types: looks for a field annotation, than for the corresponding setter annotation, and for special cases falls back to generic types.
Field Summary |
---|
Fields inherited from class com.opensymphony.xwork.util.DefaultObjectTypeDeterminer |
---|
CREATE_IF_NULL_PREFIX, DEPRECATED_ELEMENT_PREFIX, ELEMENT_PREFIX, KEY_PREFIX, KEY_PROPERTY_PREFIX, LOG |
Constructor Summary | |
---|---|
GenericsObjectTypeDeterminer()
|
Method Summary | ||
---|---|---|
protected
|
getAnnotation(Class parentClass,
String property,
Class<T> annotationClass)
Retrieves an annotation for the specified property of field, setter or getter. |
|
Class |
getElementClass(Class parentClass,
String property,
Object key)
Determines the element class by looking for the value of @Element annotation for the given class. |
|
Class |
getKeyClass(Class parentClass,
String property)
Determines the key class by looking for the value of @Key annotation for the given class. |
|
String |
getKeyProperty(Class parentClass,
String property)
Determines the key property for a Collection by getting it from the @KeyProperty annotation. |
|
boolean |
shouldCreateIfNew(Class parentClass,
String property,
Object target,
String keyProperty,
boolean isIndexAccessed)
Determines the createIfNull property for a Collection or Map by getting it from the @CreateIfNull annotation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericsObjectTypeDeterminer()
Method Detail |
---|
public Class getKeyClass(Class parentClass, String property)
getKeyClass
in interface com.opensymphony.xwork.util.ObjectTypeDeterminer
getKeyClass
in class com.opensymphony.xwork.util.DefaultObjectTypeDeterminer
parentClass
- the Class which contains as a property the Map or Collection we are finding the key for.property
- the property of the Map or Collection for the given parent classObjectTypeDeterminer.getKeyClass(Class, String)
public Class getElementClass(Class parentClass, String property, Object key)
getElementClass
in interface com.opensymphony.xwork.util.ObjectTypeDeterminer
getElementClass
in class com.opensymphony.xwork.util.DefaultObjectTypeDeterminer
parentClass
- the Class which contains as a property the Map or Collection we are finding the key for.property
- the property of the Map or Collection for the given parent classObjectTypeDeterminer.getElementClass(Class, String, Object)
public String getKeyProperty(Class parentClass, String property)
getKeyProperty
in interface com.opensymphony.xwork.util.ObjectTypeDeterminer
getKeyProperty
in class com.opensymphony.xwork.util.DefaultObjectTypeDeterminer
parentClass
- the Class which contains as a property the Map or Collection we are finding the key for.property
- the property of the Map or Collection for the given parent classObjectTypeDeterminer.getKeyProperty(Class, String)
public boolean shouldCreateIfNew(Class parentClass, String property, Object target, String keyProperty, boolean isIndexAccessed)
shouldCreateIfNew
in interface com.opensymphony.xwork.util.ObjectTypeDeterminer
shouldCreateIfNew
in class com.opensymphony.xwork.util.DefaultObjectTypeDeterminer
parentClass
- the Class which contains as a property the Map or Collection we are finding the key for.property
- the property of the Map or Collection for the given parent classtarget
- keyProperty
- isIndexAccessed
- true, if the collection or map is accessed via index, false otherwise.ObjectTypeDeterminer#getKeyProperty(Class, String)
protected <T extends Annotation> T getAnnotation(Class parentClass, String property, Class<T> annotationClass)
T
- the annotation type to be retrievedparentClass
- the classproperty
- the propertyannotationClass
- the annotation
null
if not found
|
XWork Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |