java.beans
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:
- There must be at least a get(int) or a set(int,...) method.
Nothing else is required. Spec note:One nice restriction
would be that if there is a get() there must be a get(int), same
with set, but that is not in the spec and is fairly harmless.)
- A get array method must have signature
<propertyType>[] <getMethodName>()
- A set array method must have signature
void <setMethodName>(<propertyType>[])
- A get index method must have signature
<propertyType> <getMethodName>(int)
- A set index method must have signature
void <setMethodName>(int,<propertyType>)
- All these methods may throw any exception.
- All these methods must be public.
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.
|
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 |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
IndexedPropertyDescriptor
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 named
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.
IndexedPropertyDescriptor
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.
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.
IndexedPropertyDescriptor
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.
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.
IndexedPropertyDescriptor.java --
Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.