java.lang.Object
java.beans.FeatureDescriptor
java.beans.PropertyDescriptor
java.beans.IndexedPropertyDescriptor
IndexedPropertyDescriptor 描述了一个类似于数组的属性,并具有索引读取和/或索引写入方法来访问数组的特定元素。
索引属性也可以提供简单的非索引读写方法。如果存在,它们将读取和写入由索引读取方法返回的类型的数组。
- 自从:
- 1.1
-
构造方法总结
构造方法构造方法描述IndexedPropertyDescriptor(String propertyName, Class<?> beanClass) 此构造方法为属性构造一个 IndexedPropertyDescriptor,该属性通过具有 getFoo 和 setFoo 访问器方法来遵循标准 Java 约定,用于索引访问和数组访问。IndexedPropertyDescriptor(String propertyName, Class<?> beanClass, String readMethodName, String writeMethodName, String indexedReadMethodName, String indexedWriteMethodName) 此构造方法采用简单属性的名称,以及用于读取和写入属性的方法名称,包括索引和非索引。IndexedPropertyDescriptor(String propertyName, Method readMethod, Method writeMethod, Method indexedReadMethod, Method indexedWriteMethod) 此构造方法采用简单属性的名称和用于读取和写入属性的方法对象。 -
方法总结
修饰符和类型方法描述boolean将此PropertyDescriptor与指定对象进行比较。Class<?>返回索引属性的 Java 类型信息。获取应该用于读取索引属性值的方法。获取应用于写入索引属性值的方法。inthashCode()返回对象的哈希码值。voidsetIndexedReadMethod(Method readMethod) 设置应该用于读取索引属性值的方法。voidsetIndexedWriteMethod(Method writeMethod) 设置应该用于写入索引属性值的方法。在类 java.beans.PropertyDescriptor 中声明的方法
createPropertyEditor, getPropertyEditorClass, getPropertyType, getReadMethod, getWriteMethod, isBound, isConstrained, setBound, setConstrained, setPropertyEditorClass, setReadMethod, setWriteMethod在类 java.beans.FeatureDescriptor 中声明的方法
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toString
-
构造方法详细信息
-
IndexedPropertyDescriptor
public IndexedPropertyDescriptor(String propertyName, Class <?> beanClass) throws IntrospectionException 此构造方法为属性构造一个 IndexedPropertyDescriptor,该属性通过具有 getFoo 和 setFoo 访问器方法来遵循标准 Java 约定,用于索引访问和数组访问。因此,如果参数名称是“fred”,它将假设有一个索引读取器方法“getFred”,一个非索引(数组)读取器方法也称为“getFred”,一个索引写入器方法“setFred”,最后是一个非索引编写器方法“setFred”。
- 参数:
propertyName- 属性的编程名称。beanClass- 目标 bean 的类对象。- 抛出:
IntrospectionException- 如果在内省期间发生异常。
-
IndexedPropertyDescriptor
public IndexedPropertyDescriptor(String propertyName, Class <?> beanClass, String readMethodName, String writeMethodName, String indexedReadMethodName, String indexedWriteMethodName) throws IntrospectionException 此构造方法采用简单属性的名称,以及用于读取和写入属性的方法名称,包括索引和非索引。- 参数:
propertyName- 属性的编程名称。beanClass- 目标 bean 的类对象。readMethodName- 用于将属性值读取为数组的方法的名称。如果属性是只写的或必须被索引,则可能为 null。writeMethodName- 用于将属性值写入数组的方法的名称。如果属性是只读的或必须被索引,则可能为 null。indexedReadMethodName- 用于读取索引属性值的方法的名称。如果属性是只写的,则可能为 null。indexedWriteMethodName- 用于写入索引属性值的方法的名称。如果属性是只读的,则可能为 null。- 抛出:
IntrospectionException- 如果在内省期间发生异常。
-
IndexedPropertyDescriptor
public IndexedPropertyDescriptor(String propertyName, Method readMethod, Method writeMethod, Method indexedReadMethod, Method indexedWriteMethod) throws IntrospectionException 此构造方法采用简单属性的名称和用于读取和写入属性的方法对象。- 参数:
propertyName- 属性的编程名称。readMethod- 用于将属性值读取为数组的方法。如果属性是只写的或必须被索引,则可能为 null。writeMethod- 用于将属性值写入数组的方法。如果属性是只读的或必须被索引,则可能为 null。indexedReadMethod- 用于读取索引属性值的方法。如果属性是只写的,则可能为 null。indexedWriteMethod- 用于写入索引属性值的方法。如果属性是只读的,则可能为 null。- 抛出:
IntrospectionException- 如果在内省期间发生异常。
-
-
方法详情
-
getIndexedReadMethod
获取应该用于读取索引属性值的方法。- 返回:
- 应该用于读取索引属性值的方法。如果属性未编入索引或为只写,则可能返回 null。
-
setIndexedReadMethod
设置应该用于读取索引属性值的方法。- 参数:
readMethod- 新的索引读取方法。- 抛出:
IntrospectionException- 如果在内省期间发生异常。- 自从:
- 1.2
-
getIndexedWriteMethod
获取应用于写入索引属性值的方法。- 返回:
- 应该用于写入索引属性值的方法。如果属性未编入索引或为只读,则可能返回 null。
-
setIndexedWriteMethod
设置应该用于写入索引属性值的方法。- 参数:
writeMethod- 新的索引写入方法。- 抛出:
IntrospectionException- 如果在内省期间发生异常。- 自从:
- 1.2
-
getIndexedPropertyType
返回索引属性的 Java 类型信息。请注意,Class对象可以描述原始 Java 类型,例如int。该类型由索引读取方法返回或用作索引写入方法的参数类型。- 返回:
-
表示 Java 类型信息的
Class对象,如果无法确定类型,则为null
-
equals
将此PropertyDescriptor与指定对象进行比较。如果对象相同,则返回 true。如果读取、写入、属性类型、属性编辑器和标志等同,则两个PropertyDescriptor相同。- 重写:
equals在类PropertyDescriptor中- 参数:
obj- 要比较的参考对象。- 返回:
true如果此对象与 obj 参数相同;false否则。- 自从:
- 1.4
- 参见:
-
hashCode
public int hashCode()返回对象的哈希码值。有关完整说明,请参阅Object.hashCode()。- 重写:
hashCode在类PropertyDescriptor中- 返回:
- 此对象的哈希码值。
- 自从:
- 1.5
- 参见:
-