java.beans
Class PropertyDescriptor

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.beans.FeatureDescriptor sample code for java.beans.FeatureDescriptor definition code for java.beans.FeatureDescriptor 
      extended by java.beans.PropertyDescriptor
Direct Known Subclasses:
IndexedPropertyDescriptor sample code for java.beans.IndexedPropertyDescriptor definition code for java.beans.IndexedPropertyDescriptor

public class PropertyDescriptor
extends FeatureDescriptor sample code for java.beans.FeatureDescriptor definition code for java.beans.FeatureDescriptor

A PropertyDescriptor describes one property that a Java Bean exports via a pair of accessor methods.


Constructor Summary
PropertyDescriptor sample code for java.beans.PropertyDescriptor.PropertyDescriptor(java.lang.String, java.lang.Class) definition code for java.beans.PropertyDescriptor.PropertyDescriptor(java.lang.String, java.lang.Class) (String sample code for java.lang.String definition code for java.lang.String  propertyName, Class sample code for java.lang.Class definition code for java.lang.Class <?> beanClass)
          Constructs a PropertyDescriptor for a property that follows the standard Java convention by having getFoo and setFoo accessor methods.
PropertyDescriptor sample code for java.beans.PropertyDescriptor.PropertyDescriptor(java.lang.String, java.lang.Class, java.lang.String, java.lang.String) definition code for java.beans.PropertyDescriptor.PropertyDescriptor(java.lang.String, java.lang.Class, java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  propertyName, Class sample code for java.lang.Class definition code for java.lang.Class <?> beanClass, String sample code for java.lang.String definition code for java.lang.String  readMethodName, String sample code for java.lang.String definition code for java.lang.String  writeMethodName)
          This constructor takes the name of a simple property, and method names for reading and writing the property.
PropertyDescriptor sample code for java.beans.PropertyDescriptor.PropertyDescriptor(java.lang.String, java.lang.reflect.Method, java.lang.reflect.Method) definition code for java.beans.PropertyDescriptor.PropertyDescriptor(java.lang.String, java.lang.reflect.Method, java.lang.reflect.Method) (String sample code for java.lang.String definition code for java.lang.String  propertyName, Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  readMethod, Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  writeMethod)
          This constructor takes the name of a simple property, and Method objects for reading and writing the property.
 
Method Summary
 PropertyEditor sample code for java.beans.PropertyEditor definition code for java.beans.PropertyEditor createPropertyEditor sample code for java.beans.PropertyDescriptor.createPropertyEditor(java.lang.Object) definition code for java.beans.PropertyDescriptor.createPropertyEditor(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  bean)
          Constructs an instance of a property editor using the current property editor class.
 boolean equals sample code for java.beans.PropertyDescriptor.equals(java.lang.Object) definition code for java.beans.PropertyDescriptor.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Compares this PropertyDescriptor against the specified object.
 Class sample code for java.lang.Class definition code for java.lang.Class <?> getPropertyEditorClass sample code for java.beans.PropertyDescriptor.getPropertyEditorClass() definition code for java.beans.PropertyDescriptor.getPropertyEditorClass() ()
          Gets any explicit PropertyEditor Class that has been registered for this property.
 Class sample code for java.lang.Class definition code for java.lang.Class <?> getPropertyType sample code for java.beans.PropertyDescriptor.getPropertyType() definition code for java.beans.PropertyDescriptor.getPropertyType() ()
          Gets the Class object for the property.
 Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method getReadMethod sample code for java.beans.PropertyDescriptor.getReadMethod() definition code for java.beans.PropertyDescriptor.getReadMethod() ()
          Gets the method that should be used to read the property value.
 Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method getWriteMethod sample code for java.beans.PropertyDescriptor.getWriteMethod() definition code for java.beans.PropertyDescriptor.getWriteMethod() ()
          Gets the method that should be used to write the property value.
 int hashCode sample code for java.beans.PropertyDescriptor.hashCode() definition code for java.beans.PropertyDescriptor.hashCode() ()
          Returns a hash code value for the object.
 boolean isBound sample code for java.beans.PropertyDescriptor.isBound() definition code for java.beans.PropertyDescriptor.isBound() ()
          Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.
 boolean isConstrained sample code for java.beans.PropertyDescriptor.isConstrained() definition code for java.beans.PropertyDescriptor.isConstrained() ()
          Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.
 void setBound sample code for java.beans.PropertyDescriptor.setBound(boolean) definition code for java.beans.PropertyDescriptor.setBound(boolean) (boolean bound)
          Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.
 void setConstrained sample code for java.beans.PropertyDescriptor.setConstrained(boolean) definition code for java.beans.PropertyDescriptor.setConstrained(boolean) (boolean constrained)
          Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.
 void setPropertyEditorClass sample code for java.beans.PropertyDescriptor.setPropertyEditorClass(java.lang.Class) definition code for java.beans.PropertyDescriptor.setPropertyEditorClass(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <?> propertyEditorClass)
          Normally PropertyEditors will be found using the PropertyEditorManager.
 void setReadMethod sample code for java.beans.PropertyDescriptor.setReadMethod(java.lang.reflect.Method) definition code for java.beans.PropertyDescriptor.setReadMethod(java.lang.reflect.Method) (Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  readMethod)
          Sets the method that should be used to read the property value.
 void setWriteMethod sample code for java.beans.PropertyDescriptor.setWriteMethod(java.lang.reflect.Method) definition code for java.beans.PropertyDescriptor.setWriteMethod(java.lang.reflect.Method) (Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  writeMethod)
          Sets the method that should be used to write the property value.
 
Methods inherited from class java.beans.FeatureDescriptor sample code for java.beans.FeatureDescriptor definition code for java.beans.FeatureDescriptor
attributeNames sample code for java.beans.FeatureDescriptor.attributeNames() definition code for java.beans.FeatureDescriptor.attributeNames() , getDisplayName sample code for java.beans.FeatureDescriptor.getDisplayName() definition code for java.beans.FeatureDescriptor.getDisplayName() , getName sample code for java.beans.FeatureDescriptor.getName() definition code for java.beans.FeatureDescriptor.getName() , getShortDescription sample code for java.beans.FeatureDescriptor.getShortDescription() definition code for java.beans.FeatureDescriptor.getShortDescription() , getValue sample code for java.beans.FeatureDescriptor.getValue(java.lang.String) definition code for java.beans.FeatureDescriptor.getValue(java.lang.String) , isExpert sample code for java.beans.FeatureDescriptor.isExpert() definition code for java.beans.FeatureDescriptor.isExpert() , isHidden sample code for java.beans.FeatureDescriptor.isHidden() definition code for java.beans.FeatureDescriptor.isHidden() , isPreferred sample code for java.beans.FeatureDescriptor.isPreferred() definition code for java.beans.FeatureDescriptor.isPreferred() , setDisplayName sample code for java.beans.FeatureDescriptor.setDisplayName(java.lang.String) definition code for java.beans.FeatureDescriptor.setDisplayName(java.lang.String) , setExpert sample code for java.beans.FeatureDescriptor.setExpert(boolean) definition code for java.beans.FeatureDescriptor.setExpert(boolean) , setHidden sample code for java.beans.FeatureDescriptor.setHidden(boolean) definition code for java.beans.FeatureDescriptor.setHidden(boolean) , setName sample code for java.beans.FeatureDescriptor.setName(java.lang.String) definition code for java.beans.FeatureDescriptor.setName(java.lang.String) , setPreferred sample code for java.beans.FeatureDescriptor.setPreferred(boolean) definition code for java.beans.FeatureDescriptor.setPreferred(boolean) , setShortDescription sample code for java.beans.FeatureDescriptor.setShortDescription(java.lang.String) definition code for java.beans.FeatureDescriptor.setShortDescription(java.lang.String) , setValue sample code for java.beans.FeatureDescriptor.setValue(java.lang.String, java.lang.Object) definition code for java.beans.FeatureDescriptor.setValue(java.lang.String, java.lang.Object)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

PropertyDescriptor sample code for java.beans.PropertyDescriptor(java.lang.String, java.lang.Class<?>) definition code for java.beans.PropertyDescriptor(java.lang.String, java.lang.Class<?>)

public PropertyDescriptor(String sample code for java.lang.String definition code for java.lang.String  propertyName,
                          Class sample code for java.lang.Class definition code for java.lang.Class <?> beanClass)
                   throws IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException 
Constructs a PropertyDescriptor for a property that follows the standard Java convention by having getFoo and setFoo accessor methods. Thus if the argument name is "fred", it will assume that the writer method is "setFred" and the reader method is "getFred" (or "isFred" for a boolean property). Note that the property name should start with a lower case character, which will be capitalized in the method names.

Parameters:
propertyName - The programmatic name of the property.
beanClass - The Class object for the target bean. For example sun.beans.OurButton.class.
Throws:
IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException - if an exception occurs during introspection.

PropertyDescriptor sample code for java.beans.PropertyDescriptor(java.lang.String, java.lang.Class<?>, java.lang.String, java.lang.String) definition code for java.beans.PropertyDescriptor(java.lang.String, java.lang.Class<?>, java.lang.String, java.lang.String)

public PropertyDescriptor(String sample code for java.lang.String definition code for java.lang.String  propertyName,
                          Class sample code for java.lang.Class definition code for java.lang.Class <?> beanClass,
                          String sample code for java.lang.String definition code for java.lang.String  readMethodName,
                          String sample code for java.lang.String definition code for java.lang.String  writeMethodName)
                   throws IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException 
This constructor takes the name of a simple property, and method names for reading and writing the property.

Parameters:
propertyName - The programmatic name of the property.
beanClass - The Class object for the target bean. For example sun.beans.OurButton.class.
readMethodName - The name of the method used for reading the property value. May be null if the property is write-only.
writeMethodName - The name of the method used for writing the property value. May be null if the property is read-only.
Throws:
IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException - if an exception occurs during introspection.

PropertyDescriptor sample code for java.beans.PropertyDescriptor(java.lang.String, java.lang.reflect.Method, java.lang.reflect.Method) definition code for java.beans.PropertyDescriptor(java.lang.String, java.lang.reflect.Method, java.lang.reflect.Method)

public PropertyDescriptor(String sample code for java.lang.String definition code for java.lang.String  propertyName,
                          Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  readMethod,
                          Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  writeMethod)
                   throws IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException 
This constructor takes the name of a simple property, and Method objects for reading and writing the property.

Parameters:
propertyName - The programmatic name of the property.
readMethod - The method used for reading the property value. May be null if the property is write-only.
writeMethod - The method used for writing the property value. May be null if the property is read-only.
Throws:
IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException - if an exception occurs during introspection.
Method Detail

getPropertyType sample code for java.beans.PropertyDescriptor.getPropertyType() definition code for java.beans.PropertyDescriptor.getPropertyType()

public Class sample code for java.lang.Class definition code for java.lang.Class <?> getPropertyType()
Gets the Class object for the property.

Returns:
The Java type info for the property. Note that the "Class" object may describe a built-in Java type such as "int". The result may be "null" if this is an indexed property that does not support non-indexed access.

This is the type that will be returned by the ReadMethod.


getReadMethod sample code for java.beans.PropertyDescriptor.getReadMethod() definition code for java.beans.PropertyDescriptor.getReadMethod()

public Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  getReadMethod()
Gets the method that should be used to read the property value.

Returns:
The method that should be used to read the property value. May return null if the property can't be read.

setReadMethod sample code for java.beans.PropertyDescriptor.setReadMethod(java.lang.reflect.Method) definition code for java.beans.PropertyDescriptor.setReadMethod(java.lang.reflect.Method)

public void setReadMethod(Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  readMethod)
                   throws IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException 
Sets the method that should be used to read the property value.

Parameters:
readMethod - The new read method.
Throws:
IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException

getWriteMethod sample code for java.beans.PropertyDescriptor.getWriteMethod() definition code for java.beans.PropertyDescriptor.getWriteMethod()

public Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  getWriteMethod()
Gets the method that should be used to write the property value.

Returns:
The method that should be used to write the property value. May return null if the property can't be written.

setWriteMethod sample code for java.beans.PropertyDescriptor.setWriteMethod(java.lang.reflect.Method) definition code for java.beans.PropertyDescriptor.setWriteMethod(java.lang.reflect.Method)

public void setWriteMethod(Method sample code for java.lang.reflect.Method definition code for java.lang.reflect.Method  writeMethod)
                    throws IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException 
Sets the method that should be used to write the property value.

Parameters:
writeMethod - The new write method.
Throws:
IntrospectionException sample code for java.beans.IntrospectionException definition code for java.beans.IntrospectionException

isBound sample code for java.beans.PropertyDescriptor.isBound() definition code for java.beans.PropertyDescriptor.isBound()

public boolean isBound()
Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.

Returns:
True if this is a bound property.

setBound sample code for java.beans.PropertyDescriptor.setBound(boolean) definition code for java.beans.PropertyDescriptor.setBound(boolean)

public void setBound(boolean bound)
Updates to "bound" properties will cause a "PropertyChange" event to get fired when the property is changed.

Parameters:
bound - True if this is a bound property.

isConstrained sample code for java.beans.PropertyDescriptor.isConstrained() definition code for java.beans.PropertyDescriptor.isConstrained()

public boolean isConstrained()
Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.

Returns:
True if this is a constrained property.

setConstrained sample code for java.beans.PropertyDescriptor.setConstrained(boolean) definition code for java.beans.PropertyDescriptor.setConstrained(boolean)

public void setConstrained(boolean constrained)
Attempted updates to "Constrained" properties will cause a "VetoableChange" event to get fired when the property is changed.

Parameters:
constrained - True if this is a constrained property.

setPropertyEditorClass sample code for java.beans.PropertyDescriptor.setPropertyEditorClass(java.lang.Class<?>) definition code for java.beans.PropertyDescriptor.setPropertyEditorClass(java.lang.Class<?>)

public void setPropertyEditorClass(Class sample code for java.lang.Class definition code for java.lang.Class <?> propertyEditorClass)
Normally PropertyEditors will be found using the PropertyEditorManager. However if for some reason you want to associate a particular PropertyEditor with a given property, then you can do it with this method.

Parameters:
propertyEditorClass - The Class for the desired PropertyEditor.

getPropertyEditorClass sample code for java.beans.PropertyDescriptor.getPropertyEditorClass() definition code for java.beans.PropertyDescriptor.getPropertyEditorClass()

public Class sample code for java.lang.Class definition code for java.lang.Class <?> getPropertyEditorClass()
Gets any explicit PropertyEditor Class that has been registered for this property.

Returns:
Any explicit PropertyEditor Class that has been registered for this property. Normally this will return "null", indicating that no special editor has been registered, so the PropertyEditorManager should be used to locate a suitable PropertyEditor.

createPropertyEditor sample code for java.beans.PropertyDescriptor.createPropertyEditor(java.lang.Object) definition code for java.beans.PropertyDescriptor.createPropertyEditor(java.lang.Object)

public PropertyEditor sample code for java.beans.PropertyEditor definition code for java.beans.PropertyEditor  createPropertyEditor(Object sample code for java.lang.Object definition code for java.lang.Object  bean)
Constructs an instance of a property editor using the current property editor class.

If the property editor class has a public constructor that takes an Object argument then it will be invoked using the bean parameter as the argument. Otherwise, the default constructor will be invoked.

Parameters:
bean - the source object
Returns:
a property editor instance or null if a property editor has not been defined or cannot be created
Since:
1.5

equals sample code for java.beans.PropertyDescriptor.equals(java.lang.Object) definition code for java.beans.PropertyDescriptor.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Compares this PropertyDescriptor against the specified object. Returns true if the objects are the same. Two PropertyDescriptors are the same if the read, write, property types, property editor and flags are equivalent.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
Since:
1.4
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for java.beans.PropertyDescriptor.hashCode() definition code for java.beans.PropertyDescriptor.hashCode()

public int hashCode()
Returns a hash code value for the object. See Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() for a complete description.

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a hash code value for this object.
Since:
1.5
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable