public class Mirrors extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
Mirrors.FieldHandler
字段处理器
|
static interface |
Mirrors.PropertyHandler
属性处理器
|
| 限定符和类型 | 方法和说明 |
|---|---|
static <T extends Annotation> |
getAnnotation(PropertyDescriptor propertyDescriptor,
Class<T> annotationType)
依靠属性或者字段查找注解
|
static Field[] |
getFields(Class<? extends Object> type)
获得指定类型及其父类的所有属性
|
static Class |
getGenricReturnType(Method method,
int index)
获得方法返回类型的参数泛型
|
static Map<String,PropertyDescriptor> |
getPropertyMap(Class<?> type) |
static PropertyDescriptor[] |
getPropertys(Class<?> type) |
static Class<?> |
getSuperClassGenricType(Class<?> clazz,
int index)
获得超类的泛型
|
static float |
getTotalTransformationCost(Class<?>[] srcArgs,
Class<?>[] destArgs)
返回类型匹配转换需要的成本总和,越小越精确。
|
static void |
handleField(String packagePattern,
Object domain,
Mirrors.FieldHandler fieldHandler)
处理字段
|
static void |
handleProperty(String packagePattern,
Object domain,
Mirrors.PropertyHandler propertyHandler)
处理属性
|
public static Class getGenricReturnType(Method method, int index)
method - index - public static <T extends Annotation> T getAnnotation(PropertyDescriptor propertyDescriptor, Class<T> annotationType)
propertyDescriptor - annotationType - public static Field[] getFields(Class<? extends Object> type)
type - public static Map<String,PropertyDescriptor> getPropertyMap(Class<?> type)
public static PropertyDescriptor[] getPropertys(Class<?> type)
public static void handleProperty(String packagePattern, Object domain, Mirrors.PropertyHandler propertyHandler)
packagePattern - 包模式,如com..aaa..service..domain - 领域对象propertyHandler - 属性处理器public static void handleField(String packagePattern, Object domain, Mirrors.FieldHandler fieldHandler)
packagePattern - 包模式,如com..aaa..service..domain - 领域对象fieldHandler - 字段处理器public static Class<?> getSuperClassGenricType(Class<?> clazz, int index)
clazz - 超类index - 泛型序号Copyright © 2024. All rights reserved.