Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.beans.FeatureDescriptor
java.beans.PropertyDescriptor
java.beans.IndexedPropertyDescriptor
public class IndexedPropertyDescriptor
extends PropertyDescriptor
An example property would have four methods like this:
FooBar[] getFoo()
void setFoo(FooBar[])
FooBar getFoo(int)
void setFoo(int,FooBar)
The constraints put on get and set methods are:
<propertyType>[] <getMethodName>()
void <setMethodName>(<propertyType>[])
<propertyType> <getMethodName>(int)
void <setMethodName>(int,<propertyType>)
Constructor Summary | |
| |
Method Summary | |
Class | |
Method | |
Method | |
void |
|
void |
|
Methods inherited from class java.beans.PropertyDescriptor | |
createPropertyEditor , equals , getPropertyEditorClass , getPropertyType , getReadMethod , getWriteMethod , hashCode , isBound , isConstrained , setBound , setConstrained , setPropertyEditorClass , setReadMethod , setWriteMethod |
Methods inherited from class java.beans.FeatureDescriptor | |
attributeNames , getDisplayName , getName , getShortDescription , getValue , isExpert , isHidden , isPreferred , setDisplayName , setExpert , setHidden , setName , setPreferred , setShortDescription , setValue |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public IndexedPropertyDescriptor(String name, Class beanClass) throws IntrospectionException
Create a new IndexedPropertyDescriptor by introspection. This form of constructor creates the PropertyDescriptor by looking for getter methods namedget<name>()
and setter methods namedset<name>()
in class<beanClass>
, where <name> has its first letter capitalized by the constructor.Implementation note: If there is a get(int) method, then the return type of that method is used to find the remaining methods. If there is no get method, then the set(int) method is searched for exhaustively and that type is used to find the others.
Spec note: If there is no get(int) method and multiple set(int) methods with the same name and the correct parameters (different type of course), then an IntrospectionException is thrown. While Sun's spec does not state this, it can make Bean behavior different on different systems (since method order is not guaranteed) and as such, can be treated as a bug in the spec. I am not aware of whether Sun's implementation catches this.
- Parameters:
name
- the programmatic name of the property, usually starting with a lowercase letter (e.g. fooManChu instead of FooManChu).beanClass
- the class the get and set methods live in.
- Throws:
IntrospectionException
- if the methods are not found or invalid.
public IndexedPropertyDescriptor(String name, Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException
Create a new IndexedPropertyDescriptor by introspection. This form of constructor allows you to specify the names of the get and set methods to search for.Implementation note: If there is a get(int) method, then the return type of that method is used to find the remaining methods. If there is no get method, then the set(int) method is searched for exhaustively and that type is used to find the others.
Spec note: If there is no get(int) method and multiple set(int) methods with the same name and the correct parameters (different type of course), then an IntrospectionException is thrown. While Sun's spec does not state this, it can make Bean behavior different on different systems (since method order is not guaranteed) and as such, can be treated as a bug in the spec. I am not aware of whether Sun's implementation catches this.
- Parameters:
name
- the programmatic name of the property, usually starting with a lowercase letter (e.g. fooManChu instead of FooManChu).beanClass
- the class the get and set methods live in.getMethodName
- the name of the get array method.setMethodName
- the name of the set array method.getIndexName
- the name of the get index method.setIndexName
- the name of the set index method.
- Throws:
IntrospectionException
- if the methods are not found or invalid.
public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException
Create a new PropertyDescriptor using explicit Methods. Note that the methods will be checked for conformance to standard Property method rules, as described above at the top of this class.
- Parameters:
name
- the programmatic name of the property, usually starting with a lowercase letter (e.g. fooManChu instead of FooManChu).getMethod
- the get array method.setMethod
- the set array method.getIndex
- the get index method.setIndex
- the set index method.
- Throws:
IntrospectionException
- if the methods are not found or invalid.
public void setIndexedReadMethod(Method m) throws IntrospectionException
Sets the method that is used to read an indexed property.
- Parameters:
m
- the method to set
public void setIndexedWriteMethod(Method m) throws IntrospectionException
Sets the method that is used to write an indexed property.
- Parameters:
m
- the method to set