Class PropertyDescriptor
java.lang.Object
cloud.opencode.base.core.bean.PropertyDescriptor
Bean Property Descriptor - Describes a single bean property
Bean 属性描述符 - 描述单个 Bean 属性
Encapsulates property metadata including name, type, getter, setter, and field.
封装属性元数据,包括名称、类型、Getter、Setter 和字段。
Features | 主要功能:
- Property metadata (name, type, readable, writable) - 属性元数据
- Value get/set operations - 值读写操作
- Generic type information - 泛型类型信息
- Annotation access (from method/field) - 注解访问
Usage Examples | 使用示例:
// Get property descriptor - 获取属性描述符
PropertyDescriptor pd = OpenBean.getPropertyDescriptor(User.class, "name").orElse(null);
// Check readable/writable - 检查可读/可写
boolean readable = pd.isReadable();
boolean writable = pd.isWritable();
// Get/Set value - 读写值
Object value = pd.getValue(user);
pd.setValue(user, newValue);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
- Null-safe: Partial (throws on null bean) - 空值安全: 部分
- Since:
- JDK 25, opencode-base-core V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfield()<A extends Annotation>
AgetAnnotation(Class<A> annotationClass) Gets the specified annotation from this property 获取属性注解Gets the generic type of this property 获取泛型类型Gets the property value from the given bean 获取属性值booleanhasAnnotation(Class<? extends Annotation> annotationClass) Checks whether this property has the specified annotation 检查是否有指定注解booleanhasField()Checks whether this property has a corresponding field 是否有对应字段booleanChecks whether this property is readable 是否可读booleanChecks whether this property is writable 是否可写name()voidSets the property value on the given bean 设置属性值toString()Class<?> type()
-
Constructor Details
-
PropertyDescriptor
-
-
Method Details
-
name
-
type
-
readMethod
-
writeMethod
-
field
-
isReadable
public boolean isReadable()Checks whether this property is readable 是否可读 -
isWritable
public boolean isWritable()Checks whether this property is writable 是否可写 -
hasField
public boolean hasField()Checks whether this property has a corresponding field 是否有对应字段 -
getValue
-
setValue
-
getGenericType
Gets the generic type of this property 获取泛型类型 -
getAnnotation
Gets the specified annotation from this property 获取属性注解 -
hasAnnotation
Checks whether this property has the specified annotation 检查是否有指定注解 -
toString
-