| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.beans.FeatureDescriptor
java.beans.PropertyDescriptor
public class PropertyDescriptor
PropertyDescriptor 描述 Java Bean 通过一对存储器方法导出的一个属性。
| 构造方法摘要 | |
|---|---|
| PropertyDescriptor(String propertyName,
                   Class<?> beanClass)通过调用 getFoo 和 setFoo 存取方法,为符合标准 Java 约定的属性构造一个 PropertyDescriptor。 | |
| PropertyDescriptor(String propertyName,
                   Class<?> beanClass,
                   String readMethodName,
                   String writeMethodName)此构造方法带有一个简单属性的名称和用于读写属性的方法名称。 | |
| PropertyDescriptor(String propertyName,
                   Method readMethod,
                   Method writeMethod)此构造方法带有某一简单属性的名称,以及用来读取和写入属性的 Method 对象。 | |
| 方法摘要 | |
|---|---|
|  PropertyEditor | createPropertyEditor(Object bean)使用当前属性编辑器类构造一个属性编辑器实例。 | 
|  boolean | equals(Object obj)将此 PropertyDescriptor与指定对象进行比较。 | 
|  Class<?> | getPropertyEditorClass()获得已为此属性注册的任何显式 PropertyEditor Class。 | 
|  Class<?> | getPropertyType()获得属性的 Class 对象。 | 
|  Method | getReadMethod()获得应该用于读取属性值的方法。 | 
|  Method | getWriteMethod()获得应该用于写入属性值的方法。 | 
|  int | hashCode()返回对象的哈希码。 | 
|  boolean | isBound()更新 "bound" 属性将导致更改该属性时激发 "PropertyChange" 事件。 | 
|  boolean | isConstrained()试图更新 "Constrained" 属性将导致更改该属性时激发 "VetoableChange" 事件。 | 
|  void | setBound(boolean bound)更新 "bound" 属性将导致更改该属性时激发 "PropertyChange" 事件。 | 
|  void | setConstrained(boolean constrained)试图更新 "Constrained" 属性将导致更改该属性时激发 "VetoableChange" 事件。 | 
|  void | setPropertyEditorClass(Class<?> propertyEditorClass)通常 PropertyEditor 是使用 PropertyEditorManager 找到的。 | 
|  void | setReadMethod(Method readMethod)设置应该用于读取属性值的方法。 | 
|  void | setWriteMethod(Method writeMethod)设置应该用于写入属性值的方法。 | 
| 从类 java.beans.FeatureDescriptor 继承的方法 | 
|---|
| attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public PropertyDescriptor(String propertyName,
                          Class<?> beanClass)
                   throws IntrospectionException
propertyName - 属性的编程名称。beanClass - 目标 bean 的 Class 对象。例如 sun.beans.OurButton.class。
IntrospectionException - 如果在内省期间发生异常。
public PropertyDescriptor(String propertyName,
                          Class<?> beanClass,
                          String readMethodName,
                          String writeMethodName)
                   throws IntrospectionException
propertyName - 属性的编程名称。beanClass - 目标 bean 的 Class 对象。例如 sun.beans.OurButton.class。readMethodName - 用于读取属性值的方法名称。如果属性是只写的,则该参数可能为 null。writeMethodName - 用于写入属性值的方法名称。如果属性是只读的,则该参数可能为 null。
IntrospectionException - 如果在内省期间发生异常。
public PropertyDescriptor(String propertyName,
                          Method readMethod,
                          Method writeMethod)
                   throws IntrospectionException
propertyName - 属性的编程名称。readMethod - 用于读取属性值的方法。如果属性是只写的,则该参数可能为 null。writeMethod - 用于写入属性值的方法。如果属性是只读的,则该参数可能为 null。
IntrospectionException - 如果在内省期间发生异常。| 方法详细信息 | 
|---|
public Class<?> getPropertyType()
而这里的类型是由 ReadMethod 返回的类型。
public Method getReadMethod()
public void setReadMethod(Method readMethod)
                   throws IntrospectionException
readMethod - 新的读取方法。
IntrospectionExceptionpublic Method getWriteMethod()
public void setWriteMethod(Method writeMethod)
                    throws IntrospectionException
writeMethod - 新的写入方法。
IntrospectionExceptionpublic boolean isBound()
public void setBound(boolean bound)
bound - 如果该属性是绑定属性,则该属性为 true。public boolean isConstrained()
public void setConstrained(boolean constrained)
constrained - 如果该属性是约束属性,则该属性为 true。public void setPropertyEditorClass(Class<?> propertyEditorClass)
propertyEditorClass - 所需 PropertyEditor 的 Class。public Class<?> getPropertyEditorClass()
public PropertyEditor createPropertyEditor(Object bean)
如果属性编辑器类拥有一个带有 Object 参数的公共构造方法,则将通过使用 bean 参数作为变量来调用它。否则将调用默认构造方法。
bean - 源对象
public boolean equals(Object obj)
PropertyDescriptor 与指定对象进行比较。如果对象是相同的,则返回 true。如果读取、写入、属性类型、属性编辑器和标记都是等同的,则两个 PropertyDescriptor 是相同的。
Object 中的 equalsobj - 要与之比较的引用对象。
true;否则返回 false。Object.hashCode(), 
Hashtablepublic int hashCode()
Object.hashCode()。
Object 中的 hashCodeObject.equals(java.lang.Object), 
Hashtable| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。