T - 描述的类型public class BeanDescriptor<T>
extends java.lang.Object
java bean 的描述信息
| 限定符和类型 | 字段和说明 |
|---|---|
protected static java.lang.String |
DOT
句号(.)
|
protected java.lang.Class<T> |
type
类型
|
| 限定符 | 构造器和说明 |
|---|---|
protected |
BeanDescriptor(java.lang.Class<T> type) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addProperty(T obj,
java.lang.String name,
java.lang.Object value)
添加属性值(如果添加目标是Collection,则会一直添加,如果是其他类型同setProperty)
|
BeanProperty<?> |
findBeanProperty(BeanPropertyMatcher condition)
查找并返回第一个符合条件BeanProperty.
|
java.util.Collection<BeanProperty<?>> |
findBeanPropertys(BeanPropertyMatcher condition)
查找并返回所有符合条件BeanProperty的集合.
|
<A extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.Class<A> annotationClass)
返回当前对象的指定类型注解.
|
java.lang.annotation.Annotation[] |
getAnnotations()
返回当前对象的所有注解
|
static <T> BeanDescriptor<T> |
getBeanDescriptor(java.lang.Class<T> type)
返回指定类型的描述
|
java.util.Collection<BeanProperty<?>> |
getBeanProperties() |
<E> BeanProperty<E> |
getBeanProperty(int index)
返回指定索引属性.
|
<E> BeanProperty<E> |
getBeanProperty(java.lang.String name)
返回指定属性.
|
BeanProperty<?> |
getChildBeanProperty(java.lang.String name)
返回指定子孙属性.
|
java.lang.Object |
getProperty(T obj,
java.lang.String name)
返回属性
|
java.lang.Class<T> |
getType() |
<A extends java.lang.annotation.Annotation> |
hasAnnotation(java.lang.Class<A> annotationClass)
返回当前对象是否含有指定注解.
|
boolean |
hasBeanProperty(java.lang.String name)
返回指定属性是否存在
|
protected void |
initTypeGenericParam(java.lang.Class<T> type)
初始化泛型参数
|
void |
setProperty(T obj,
java.lang.String name,
java.lang.Object value)
设置属性
|
protected static final java.lang.String DOT
protected java.lang.Class<T> type
protected BeanDescriptor(java.lang.Class<T> type)
type - 类型protected void initTypeGenericParam(java.lang.Class<T> type)
初始化泛型参数
type - typepublic java.util.Collection<BeanProperty<?>> getBeanProperties()
public <E> BeanProperty<E> getBeanProperty(int index)
返回指定索引属性.
index - 索引public <E> BeanProperty<E> getBeanProperty(java.lang.String name)
返回指定属性. 如果没有则抛出NoSuchPropertyException异常
name - 属性名public boolean hasBeanProperty(java.lang.String name)
返回指定属性是否存在
name - 属性名public BeanProperty<?> getChildBeanProperty(java.lang.String name)
返回指定子孙属性. 如果没有则抛出NoSuchPropertyException异常
name - 属性名public BeanProperty<?> findBeanProperty(BeanPropertyMatcher condition)
查找并返回第一个符合条件BeanProperty. 如果没有则返回null.
condition - 条件判断public java.util.Collection<BeanProperty<?>> findBeanPropertys(BeanPropertyMatcher condition)
查找并返回所有符合条件BeanProperty的集合. 如果没有则返回一个长度为0的集合.
condition - 条件判断public void setProperty(T obj, java.lang.String name, java.lang.Object value)
设置属性
obj - 目标对象name - 属性名称value - 属性值public void addProperty(T obj, java.lang.String name, java.lang.Object value)
添加属性值(如果添加目标是Collection,则会一直添加,如果是其他类型同setProperty)
obj - 对象name - 属性名value - 属性值public java.lang.Object getProperty(T obj, java.lang.String name)
返回属性
obj - 目标对象name - 属性名public <A extends java.lang.annotation.Annotation> boolean hasAnnotation(java.lang.Class<A> annotationClass)
返回当前对象是否含有指定注解.
A - 注解类型annotationClass - 注解类型public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationClass)
返回当前对象的指定类型注解.
A - 注解类型annotationClass - 注解类型public java.lang.annotation.Annotation[] getAnnotations()
返回当前对象的所有注解
public static <T> BeanDescriptor<T> getBeanDescriptor(java.lang.Class<T> type)
T - 类型type - 类型public java.lang.Class<T> getType()