java.lang.Object | +--java.beans.FeatureDescriptor | +--java.beans.PropertyDescriptor | +--java.beans.IndexedPropertyDescriptor
IndexedPropertyDescriptor(java.lang.String name, java.lang.Class beanClass) Create a new IndexedPropertyDescriptor by introspection. |
IndexedPropertyDescriptor(java.lang.String name, java.lang.Class beanClass, java.lang.String getMethodName, java.lang.String setMethodName, java.lang.String getIndexName, java.lang.String setIndexName) Create a new IndexedPropertyDescriptor by introspection. |
IndexedPropertyDescriptor(java.lang.String name, java.lang.reflect.Method getMethod, java.lang.reflect.Method setMethod, java.lang.reflect.Method getIndex, java.lang.reflect.Method setIndex) Create a new PropertyDescriptor using explicit Methods. |
java.lang.Class | getIndexedPropertyType() |
java.lang.reflect.Method | getIndexedReadMethod() |
java.lang.reflect.Method | getIndexedWriteMethod() |
public IndexedPropertyDescriptor(java.lang.String name, java.lang.Class beanClass)
get<name>()
and setter methods named
set<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.
name
- the programmatic name of the property, usually
starting with a lowercase letter (e.g.beanClass
- the class the get and set methods live in.IntrospectionException
- if the methods are not found or invalid.public IndexedPropertyDescriptor(java.lang.String name, java.lang.Class beanClass, java.lang.String getMethodName, java.lang.String setMethodName, java.lang.String getIndexName, java.lang.String setIndexName)
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.
name
- the programmatic name of the property, usually
starting with a lowercase letter (e.g.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.IntrospectionException
- if the methods are not found or invalid.public IndexedPropertyDescriptor(java.lang.String name, java.lang.reflect.Method getMethod, java.lang.reflect.Method setMethod, java.lang.reflect.Method getIndex, java.lang.reflect.Method setIndex)
name
- the programmatic name of the property, usually
starting with a lowercase letter (e.g.getMethod
- the get array method.setMethod
- the set array method.getIndex
- the get index method.setIndex
- the set index method.IntrospectionException
- if the methods are not found or invalid.public Class getIndexedPropertyType()
public Method getIndexedReadMethod()
public Method getIndexedWriteMethod()
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>)