|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.beans.FeatureDescriptor
java.beans.PropertyDescriptor
java.beans.IndexedPropertyDescriptor
public class IndexedPropertyDescriptor
IndexedPropertyDescriptor describes information about a JavaBean indexed property, by which we mean an array-like property that has been exposed via a pair of get and set methods and another pair that allows you to get to the property by an index.
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 | |
---|---|
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. |
Method Summary | |
---|---|
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. |
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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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.Method Detail |
---|
public Class<?> getIndexedPropertyType()
public Method getIndexedReadMethod()
public void setIndexedReadMethod(Method m) throws IntrospectionException
m
- the method to set
IntrospectionException
public Method getIndexedWriteMethod()
public void setIndexedWriteMethod(Method m) throws IntrospectionException
m
- the method to set
IntrospectionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |