当前位置 类层次 (JDK) 所有类 (JDK) 所有域和方法 (JDK)

类 java.beans.IndexedPropertyDescriptor

java.lang.Object
   |
   +----java.beans.FeatureDescriptor
           |
           +----java.beans.PropertyDescriptor
                   |
                   +----java.beans.IndexedPropertyDescriptor

public class IndexedPropertyDescriptor
extends PropertyDescriptor

IndexedPropertyDescriptor 描述一个数组形式的特性并有一个索引读和/或写方法来存取数组中特定元素。

索引特性也可提供简单的非索引读写方法。若存在, 则它们能读写带索引的读方法返回的类型数组。


构造子索引

IndexedPropertyDescriptor(String, Class)
该构造子构造一个 IndexedPropertyDescriptor ,供通过拥有 getFoo 和 setFoo 实例变量存取方法来遵循标准 Java 约定的特性、索引存取和数组存取使用。
IndexedPropertyDescriptor(String, Class, String, String, String, String)
该构造子采用简单特性名和读写特性方法名,索引的和非索引的均可。
IndexedPropertyDescriptor(String, Method, Method, Method, Method)
该构造子采用简单特性名和读写特性的 Method 对象。

方法索引

getIndexedPropertyType()
getIndexedReadMethod()
getIndexedWriteMethod()

构造子

IndexedPropertyDescriptor
 public IndexedPropertyDescriptor(String propertyName,
                                  Class beanClass) throws IntrospectionException
该构造子为某特性构造一个 IndexedPropertyDescriptor ,该特性 使用 getFoo 和 setFoo 访问器方法来遵循标准 Java 约定,这些方法用语索引访问和数组访问。

因此若参数名是“fred”,则假设有一个索引阅读器“getFred”,一个命名也为“getFred”的非索引 (数组) 读程序方法,一个索引写程序方法“setFred”, 一个非索引写程序方法“setFred”。

参数:
propertyName - 特性的编程名。
beanClass - 目标 bean 的 Class 对象。
抛出: IntrospectionException
若内省时发生异常。
IndexedPropertyDescriptor
 public IndexedPropertyDescriptor(String propertyName,
                                  Class beanClass,
                                  String getterName,
                                  String setterName,
                                  String indexedGetterName,
                                  String indexedSetterName) throws IntrospectionException
该构造子采用简单特性名和读写特性方法名,索引的和非索引的均可。

参数:
propertyName - 特性的编程名。
beanClass - 目标 bean 的 Class 对象。
getterName - 以数组形式读出特性值的方法的名字。若该特性为只读的或必须加索引,则可为 null。
setterName - 以数组形式写出特性值的方法的名字。若该特性为只读的或必须加索引,则可为 null。
indexedGetterName - 用于读出索引特性值的方法的名字。若该特性为只读的,则可为 null。
indexedSetterName - 用于读出索引特性值的方法的名字。若该特性为只读的,则可为 null。
抛出: IntrospectionException
若内省时发生异常。
IndexedPropertyDescriptor
 public IndexedPropertyDescriptor(String propertyName,
                                  Method getter,
                                  Method setter,
                                  Method indexedGetter,
                                  Method indexedSetter) throws IntrospectionException
该构造子采用简单特性名和读写特性的 Method 对象。

参数:
propertyName - 特性的编程名。
getter - 以数组形式读出特性值的方法。若该特性为只读的或必须加索引,则可为 null。
setter - 以数组形式写出特性值的方法。若该特性为只读的或必须加索引,则可为 null。
indexedGetter - 用于读出索引特性值的方法。若该特性为只读的,则可为 null。
indexedSetter - 用于写入索引特性值的方法。若该特性为只读的,则可为 null。
抛出: IntrospectionException
若内省时发生异常。

方法

getIndexedReadMethod
 public Method getIndexedReadMethod()
返回值:
读一个索引特性值应使用的方法。若该特性未索引或是只读的,则可返回 null 。
getIndexedWriteMethod
 public Method getIndexedWriteMethod()
返回值:
读一个索引特性值应使用的方法。若该特性未索引或是只读的,则可返回 null 。
getIndexedPropertyType
 public Class getIndexedPropertyType()
返回值:
索引特性类型的 Java Class 。注意 Class 可描述原始的 Java 类型如“int”。

这是 indexedReadMethod 将返回的类型。


当前位置 类层次 (JDK) 所有类 (JDK) 所有域和方法 (JDK)