public class DynaBean extends CloneSupport<DynaBean> implements Serializable
Constructor and Description |
---|
DynaBean(Class<?> beanClass)
构造
|
DynaBean(Class<?> beanClass,
Object... params)
构造
|
DynaBean(Object bean)
构造
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsProp(String fieldName)
检查是否有指定名称的bean属性
|
static DynaBean |
create(Class<?> beanClass)
创建一个DynaBean
|
static DynaBean |
create(Class<?> beanClass,
Object... params)
创建一个DynaBean
|
static DynaBean |
create(Object bean)
创建一个DynaBean
|
boolean |
equals(Object obj) |
<T> T |
get(String fieldName)
获得字段对应值
|
<T> T |
getBean()
获得原始Bean
|
<T> Class<T> |
getBeanClass()
获得Bean的类型
|
int |
hashCode() |
Object |
invoke(String methodName,
Object... params)
执行原始Bean中的方法
|
<T> T |
safeGet(String fieldName)
获得字段对应值,获取异常返回
null |
void |
set(String fieldName,
Object value)
设置字段值
|
String |
toString() |
clone
public DynaBean(Class<?> beanClass, Object... params)
beanClass
- Bean类params
- 构造Bean所需要的参数public DynaBean(Class<?> beanClass)
beanClass
- Bean类public DynaBean(Object bean)
bean
- 原始Beanpublic static DynaBean create(Object bean)
bean
- 普通Beanpublic static DynaBean create(Class<?> beanClass)
beanClass
- Bean类public static DynaBean create(Class<?> beanClass, Object... params)
beanClass
- Bean类params
- 构造Bean所需要的参数public <T> T get(String fieldName) throws BeanException
T
- 属性值类型fieldName
- 字段名BeanException
- 反射获取属性值或字段值导致的异常public boolean containsProp(String fieldName)
fieldName
- 字段名public <T> T safeGet(String fieldName)
null
T
- 属性值类型fieldName
- 字段名public void set(String fieldName, Object value) throws BeanException
fieldName
- 字段名value
- 字段值BeanException
- 反射获取属性值或字段值导致的异常public Object invoke(String methodName, Object... params)
methodName
- 方法名params
- 参数public <T> T getBean()
T
- Bean类型public <T> Class<T> getBeanClass()
T
- Bean类型Copyright © 2024. All rights reserved.