org.apache.commons.beanutils
public class MappedPropertyDescriptor extends PropertyDescriptor
where Version: $Revision: 1.18.2.1 $ $Date: 2004/07/27 21:44:26 $ See Also: getProperty(String key)
and
set<Property>(String key, Object value)
,
Property
must be replaced
by the name of the property.java.beans.PropertyDescriptor
Field Summary | |
---|---|
static Hashtable | declaredMethodCache |
Class | mappedPropertyType
The underlying data type of the property we are describing. |
Method | mappedReadMethod
The reader method for this property (if any). |
Method | mappedWriteMethod
The writer method for this property (if any). |
static Class[] | stringClassArray
The parameter types array for the reader method signature. |
Constructor Summary | |
---|---|
MappedPropertyDescriptor(String propertyName, Class beanClass)
Constructs a MappedPropertyDescriptor for a property that follows
the standard Java convention by having getFoo and setFoo
accessor methods, with the addition of a String parameter (the key).
| |
MappedPropertyDescriptor(String propertyName, Class beanClass, String mappedGetterName, String mappedSetterName)
This constructor takes the name of a mapped property, and method
names for reading and writing the property.
| |
MappedPropertyDescriptor(String propertyName, Method mappedGetter, Method mappedSetter)
This constructor takes the name of a mapped property, and Method
objects for reading and writing the property.
|
Method Summary | |
---|---|
static String | capitalizePropertyName(String s)
Return a capitalized version of the specified property name.
|
void | findMappedPropertyType()
Introspect our bean class to identify the corresponding getter
and setter methods. |
static Method | findMethod(Class cls, String methodName, int argCount)
Find a target methodName on a given class. |
static Method | findMethod(Class cls, String methodName, int argCount, Class[] args)
Find a target methodName with specific parameter list on a given class. |
Class | getMappedPropertyType()
Gets the Class object for the property values.
|
Method | getMappedReadMethod()
Gets the method that should be used to read one of the property value.
|
Method | getMappedWriteMethod()
Gets the method that should be used to write one of the property value.
|
static Method[] | getPublicDeclaredMethods(Class clz) |
static Method | internalFindMethod(Class start, String methodName, int argCount)
Internal support for finding a target methodName on a given class. |
static Method | internalFindMethod(Class start, String methodName, int argCount, Class[] args)
Internal support for finding a target methodName with a given
parameter list on a given class. |
static boolean | isSubclass(Class a, Class b)
Return true if class a is either equivalent to class b, or
if class a is a subclass of class b, ie if a either "extends"
or "implements" b.
|
void | setMappedReadMethod(Method mappedGetter)
Sets the method that should be used to read one of the property value.
|
void | setMappedWriteMethod(Method mappedSetter)
Sets the method that should be used to write the property value.
|
boolean | throwsException(Method method, Class exception)
Return true iff the given method throws the given exception. |
Parameters: propertyName The programmatic name of the property. beanClass The Class object for the target bean. For example sun.beans.OurButton.class.
Throws: IntrospectionException if an exception occurs during introspection.
Parameters: propertyName The programmatic name of the property. beanClass The Class object for the target bean. For example sun.beans.OurButton.class. mappedGetterName The name of the method used for reading one of the property values. May be null if the property is write-only. mappedSetterName The name of the method used for writing one of the property values. May be null if the property is read-only.
Throws: IntrospectionException if an exception occurs during introspection.
Parameters: propertyName The programmatic name of the property. mappedGetter The method used for reading one of the property values. May be be null if the property is write-only. mappedSetter The method used for writing one the property values. May be null if the property is read-only.
Throws: IntrospectionException if an exception occurs during introspection.
Parameters: s The property name
Returns: The Java type info for the property values. Note that
the "Class" object may describe a built-in Java type such as "int".
The result may be "null" if this is a mapped property that
does not support non-keyed access.
This is the type that will be returned by the mappedReadMethod.
Returns: The method that should be used to read the property value. May return null if the property can't be read.
Returns: The method that should be used to write one of the property value. May return null if the property can't be written.
Parameters: mappedGetter The new getter method.
Parameters: mappedSetter The new setter method.