模块 java.desktop

类 IndexedPropertyDescriptor


public class IndexedPropertyDescriptor extends PropertyDescriptor
IndexedPropertyDescriptor 描述了一个类似于数组的属性,并具有索引读取和/或索引写入方法来访问数组的特定元素。

索引属性也可以提供简单的非索引读写方法。如果存在,它们将读取和写入由索引读取方法返回的类型的数组。

自从:
1.1
  • 构造方法详细信息

    • 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

      public Method  getIndexedReadMethod()
      获取应该用于读取索引属性值的方法。
      返回:
      应该用于读取索引属性值的方法。如果属性未编入索引或为只写,则可能返回 null。
    • setIndexedReadMethod

      public void setIndexedReadMethod(Method  readMethod) throws IntrospectionException
      设置应该用于读取索引属性值的方法。
      参数:
      readMethod - 新的索引读取方法。
      抛出:
      IntrospectionException - 如果在内省期间发生异常。
      自从:
      1.2
    • getIndexedWriteMethod

      public Method  getIndexedWriteMethod()
      获取应用于写入索引属性值的方法。
      返回:
      应该用于写入索引属性值的方法。如果属性未编入索引或为只读,则可能返回 null。
    • setIndexedWriteMethod

      public void setIndexedWriteMethod(Method  writeMethod) throws IntrospectionException
      设置应该用于写入索引属性值的方法。
      参数:
      writeMethod - 新的索引写入方法。
      抛出:
      IntrospectionException - 如果在内省期间发生异常。
      自从:
      1.2
    • getIndexedPropertyType

      public Class <?> getIndexedPropertyType()
      返回索引属性的 Java 类型信息。请注意,Class 对象可以描述原始 Java 类型,例如 int。该类型由索引读取方法返回或用作索引写入方法的参数类型。
      返回:
      表示 Java 类型信息的 Class 对象,如果无法确定类型,则为 null
    • equals

      public boolean equals(Object  obj)
      将此 PropertyDescriptor 与指定对象进行比较。如果对象相同,则返回 true。如果读取、写入、属性类型、属性编辑器和标志等同,则两个 PropertyDescriptor 相同。
      重写:
      equals 在类 PropertyDescriptor
      参数:
      obj - 要比较的参考对象。
      返回:
      true 如果此对象与 obj 参数相同; false否则。
      自从:
      1.4
      参见:
    • hashCode

      public int hashCode()
      返回对象的哈希码值。有关完整说明,请参阅 Object.hashCode()
      重写:
      hashCode 在类 PropertyDescriptor
      返回:
      此对象的哈希码值。
      自从:
      1.5
      参见: