public class DefaultObjectTypeDeterminer extends Object implements ObjectTypeDeterminer
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
CREATE_IF_NULL_PREFIX |
static String |
DEPRECATED_ELEMENT_PREFIX |
static String |
ELEMENT_PREFIX |
static String |
KEY_PREFIX |
static String |
KEY_PROPERTY_PREFIX |
protected static org.apache.commons.logging.Log |
LOG |
| 构造器和说明 |
|---|
DefaultObjectTypeDeterminer() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected <T extends Annotation> |
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.
|
public Class getKeyClass(Class parentClass, String property)
getKeyClass 在接口中 ObjectTypeDeterminerparentClass - 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 在接口中 ObjectTypeDeterminerparentClass - 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 在接口中 ObjectTypeDeterminerparentClass - 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 在接口中 ObjectTypeDeterminerparentClass - 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 annotationnull if not foundCopyright © 2023 onecode. All rights reserved.