java.beans
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 and Description |
---|
IndexedPropertyDescriptor(String name,
Class<?> beanClass)
Create a new IndexedPropertyDescriptor by introspection.
|
IndexedPropertyDescriptor(String name,
Class<?> beanClass,
String getMethodName,
String setMethodName,
String getIndexName,
String setIndexName)
Create a new IndexedPropertyDescriptor by introspection.
|
IndexedPropertyDescriptor(String name,
Method getMethod,
Method setMethod,
Method getIndex,
Method setIndex)
Create a new PropertyDescriptor using explicit Methods.
|
Modifier and Type | Method and Description |
---|---|
Class<?> |
getIndexedPropertyType() |
Method |
getIndexedReadMethod() |
Method |
getIndexedWriteMethod() |
void |
setIndexedReadMethod(Method m)
Sets the method that is used to read an indexed property.
|
void |
setIndexedWriteMethod(Method m)
Sets the method that is used to write an indexed property.
|
createPropertyEditor, equals, getPropertyEditorClass, getPropertyType, getReadMethod, getWriteMethod, hashCode, isBound, isConstrained, setBound, setConstrained, setPropertyEditorClass, setReadMethod, setWriteMethod
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue
public IndexedPropertyDescriptor(String name, Class<?> beanClass) throws IntrospectionException
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. fooManChu
instead of FooManChu).beanClass
- the class the get and set methods live in.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
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. 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.IntrospectionException
- if the methods are not found or invalid.public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException
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.IntrospectionException
- if the methods are not found or invalid.public Class<?> getIndexedPropertyType()
public Method getIndexedReadMethod()
public void setIndexedReadMethod(Method m) throws IntrospectionException
m
- the method to setIntrospectionException
public Method getIndexedWriteMethod()
public void setIndexedWriteMethod(Method m) throws IntrospectionException
m
- the method to setIntrospectionException