- java.lang.Object
-
- java.beans.FeatureDescriptor
-
- java.beans.PropertyDescriptor
-
- java.beans.IndexedPropertyDescriptor
-
public class IndexedPropertyDescriptor extends PropertyDescriptor
IndexedPropertyDescriptor描述了一个属性类似于数组的属性,并具有索引读取和/或索引写入方法来访问数组的特定元素。索引属性还可以提供简单的非索引读取和写入方法。 如果存在这些,则它们读取和写入索引读取方法返回的类型的数组。
- 从以下版本开始:
- 1.1
-
-
构造方法摘要
构造方法 构造器 描述 IndexedPropertyDescriptor(String propertyName, 类<?> beanClass)此构造函数通过为索引访问和数组访问提供getFoo和setFoo访问器方法,为遵循标准Java约定的属性构造IndexedPropertyDescriptor。IndexedPropertyDescriptor(String propertyName, 类<?> beanClass, String readMethodName, String writeMethodName, String indexedReadMethodName, String indexedWriteMethodName)此构造函数采用简单属性的名称,以及用于读取和写入属性的方法名称,包括索引和非索引。IndexedPropertyDescriptor(String propertyName, 方法 readMethod, 方法 writeMethod, 方法 indexedReadMethod, 方法 indexedWriteMethod)此构造函数采用简单属性的名称,而Method对象用于读取和写入属性。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 booleanequals(Object obj)将此PropertyDescriptor与指定的对象进行比较。类<?>getIndexedPropertyType()返回索引属性的Java类型信息。方法getIndexedReadMethod()获取应该用于读取索引属性值的方法。方法getIndexedWriteMethod()获取应该用于编写索引属性值的方法。inthashCode()返回对象的哈希码值。voidsetIndexedReadMethod(方法 readMethod)设置应该用于读取索引属性值的方法。voidsetIndexedWriteMethod(方法 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, 类<?> beanClass) throws IntrospectionException
此构造函数通过为索引访问和数组访问提供getFoo和setFoo访问器方法,为遵循标准Java约定的属性构造IndexedPropertyDescriptor。因此,如果参数名称是“fred”,它将假定存在索引读取器方法“getFred”,也称为“getFred”的非索引(数组)读取器方法,索引编写器方法“setFred”,最后是非索引编写器方法“setFred”。
- 参数
-
propertyName- 属性的编程名称。 -
beanClass- 目标bean的Class对象。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。
-
IndexedPropertyDescriptor
public IndexedPropertyDescriptor(String propertyName, 类<?> beanClass, String readMethodName, String writeMethodName, String indexedReadMethodName, String indexedWriteMethodName) throws IntrospectionException
此构造函数采用简单属性的名称,以及用于读取和写入属性的方法名称,包括索引和非索引。- 参数
-
propertyName- 属性的编程名称。 -
beanClass- 目标bean的Class对象。 -
readMethodName- 用于将属性值作为数组读取的方法的名称。 如果属性是只写属性或必须编入索引,则可以为null。 -
writeMethodName- 用于将属性值写为数组的方法的名称。 如果属性是只读的或必须编入索引,则可以为null。 -
indexedReadMethodName- 用于读取索引属性值的方法的名称。 如果属性是只写的,则可以为null。 -
indexedWriteMethodName- 用于写入索引属性值的方法的名称。 如果属性是只读的,则可以为null。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。
-
IndexedPropertyDescriptor
public IndexedPropertyDescriptor(String propertyName, 方法 readMethod, 方法 writeMethod, 方法 indexedReadMethod, 方法 indexedWriteMethod) throws IntrospectionException
此构造函数采用简单属性的名称,而Method对象用于读取和写入属性。- 参数
-
propertyName- 该属性的程序化名称。 -
readMethod- 用于将属性值作为数组读取的方法。 如果属性是只写属性或必须编入索引,则可以为null。 -
writeMethod- 用于将属性值写为数组的方法。 如果属性是只读的或必须编入索引,则可以为null。 -
indexedReadMethod- 用于读取索引属性值的方法。 如果属性是只写的,则可以为null。 -
indexedWriteMethod- 用于编写索引属性值的方法。 如果属性是只读的,则可以为null。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。
-
-
方法详细信息
-
getIndexedReadMethod
public 方法 getIndexedReadMethod()
获取应该用于读取索引属性值的方法。- 结果
- 应该用于读取索引属性值的方法。 如果属性未编入索引或为只写属性,则可以返回null。
-
setIndexedReadMethod
public void setIndexedReadMethod(方法 readMethod) throws IntrospectionException
设置应该用于读取索引属性值的方法。- 参数
-
readMethod- 新的索引读取方法。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。 - 从以下版本开始:
- 1.2
-
getIndexedWriteMethod
public 方法 getIndexedWriteMethod()
获取应该用于编写索引属性值的方法。- 结果
- 应该用于编写索引属性值的方法。 如果属性未编入索引或为只读属性,则可以返回null。
-
setIndexedWriteMethod
public void setIndexedWriteMethod(方法 writeMethod) throws IntrospectionException
设置应该用于编写索引属性值的方法。- 参数
-
writeMethod- 新的索引写入方法。 - 异常
-
IntrospectionException- 如果IntrospectionException期间发生异常。 - 从以下版本开始:
- 1.2
-
getIndexedPropertyType
public 类<?> getIndexedPropertyType()
返回索引属性的Java类型信息。 注意,类对象可以描述原始Java类型,例如int。 此类型由索引读取方法返回,或用作索引写入方法的参数类型。- 结果
-
表示Java类型信息的
类对象,如果无法确定类型,null
-
equals
public boolean equals(Object obj)
将此PropertyDescriptor与指定的对象进行比较。 如果对象相同,则返回true。 如果read,write,属性类型,属性编辑器和标志是等效的,则两个PropertyDescriptor是相同的。- 重写:
-
equals类PropertyDescriptor - 参数
-
obj- 要与之比较的参考对象。 - 结果
-
true如果此对象与obj参数相同; 否则为false。 - 从以下版本开始:
- 1.4
- 另请参见:
-
Object.hashCode(),HashMap
-
hashCode
public int hashCode()
返回对象的哈希码值。 有关完整说明,请参见Object.hashCode()。- 重写:
-
hashCode在课程PropertyDescriptor - 结果
- 此对象的哈希码值。
- 从以下版本开始:
- 1.5
- 另请参见:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
-