public class ReflectionBeanPropertyFactory extends java.lang.Object implements BeanPropertyFactory
动态创建指定类型指定属性对应的BeanProperty子类的工厂.
优点:默认的反射BeanProperty比动态生成的设置慢一倍,读取慢几倍.
缺点:生成大量类,占用内存空间,强类型.
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
logger
|
| Constructor and Description |
|---|
ReflectionBeanPropertyFactory() |
| Modifier and Type | Method and Description |
|---|---|
<T,V> BeanProperty<T,V> |
create(java.lang.String propertyName,
java.lang.reflect.Field field,
java.lang.Class<V> propertyType,
java.lang.reflect.Method setMethod,
java.lang.reflect.Method getMethod,
java.lang.Class<T> ownerType,
java.lang.Class<?> declaringType)
创建指定类型指定属性对应的BeanProperty.
|
public <T,V> BeanProperty<T,V> create(java.lang.String propertyName, java.lang.reflect.Field field, java.lang.Class<V> propertyType, java.lang.reflect.Method setMethod, java.lang.reflect.Method getMethod, java.lang.Class<T> ownerType, java.lang.Class<?> declaringType)
create in interface BeanPropertyFactoryT - the bean generic typeV - the property generic typepropertyName - 属性名称field - 存取数据的字段propertyType - 属性类型setMethod - 设置方法getMethod - 读取方法ownerType - 属性所在的类型declaringType - 定义属性的类型 (可能是ownerType的父类,也可能一样)