org.apache.commons.beanutils
Class WrapDynaClass
java.lang.Object
org.apache.commons.beanutils.WrapDynaClass
- DynaClass
public class WrapDynaClass
extends java.lang.Object
Implementation of
DynaClass
for DynaBeans that wrap
standard JavaBean instances.
It is suggested that this class should not usually need to be used directly
to create new
WrapDynaBean
instances.
It's usually better to call the
WrapDynaBean
constructor directly.
For example:
Object javaBean = ...;
DynaBean wrapper = new WrapDynaBean(javaBean);
$Revision: 1.8 $ $Date: 2004/02/28 13:18:34 $protected Class | beanClass - The JavaBean
Class which is represented by this
WrapDynaClass .
|
protected PropertyDescriptor[] | descriptors - The set of PropertyDescriptors for this bean class.
|
protected HashMap | descriptorsMap - The set of PropertyDescriptors for this bean class, keyed by the
property name.
|
protected static HashMap | dynaClasses - The set of
WrapDynaClass instances that have ever been
created, keyed by the underlying bean Class.
|
protected DynaProperty[] | properties - The set of dynamic properties that are part of this DynaClass.
|
protected HashMap | propertiesMap - The set of dynamic properties that are part of this DynaClass,
keyed by the property name.
|
WrapDynaClass(Class beanClass) - Construct a new WrapDynaClass for the specified JavaBean class.
|
static void | clear() - Clear our cache of WrapDynaClass instances.
|
static WrapDynaClass | createDynaClass(Class beanClass) - Create (if necessary) and return a new
WrapDynaClass
instance for the specified bean class.
|
DynaProperty[] | getDynaProperties() - Return an array of
ProperyDescriptors for the properties
currently defined in this DynaClass.
|
DynaProperty | getDynaProperty(String name) - Return a property descriptor for the specified property, if it exists;
otherwise, return
null .
|
String | getName() - Return the name of this DynaClass (analogous to the
getName() method of java.lang.Class DynaClass implementation class to support
different dynamic classes, with different sets of properties.
|
PropertyDescriptor | getPropertyDescriptor(String name) - Return the PropertyDescriptor for the specified property name, if any;
otherwise return
null .
|
protected void | introspect() - Introspect our bean class to identify the supported properties.
|
DynaBean | newInstance() - Instantiates a new standard JavaBean instance associated with
this DynaClass and return it wrapped in a new WrapDynaBean
instance.
|
beanClass
protected Class beanClass
The JavaBean Class
which is represented by this
WrapDynaClass
.
descriptors
protected PropertyDescriptor[] descriptors
The set of PropertyDescriptors for this bean class.
descriptorsMap
protected HashMap descriptorsMap
The set of PropertyDescriptors for this bean class, keyed by the
property name. Individual descriptor instances will be the same
instances as those in the descriptors
list.
dynaClasses
protected static HashMap dynaClasses
The set of WrapDynaClass
instances that have ever been
created, keyed by the underlying bean Class.
properties
protected DynaProperty[] properties
The set of dynamic properties that are part of this DynaClass.
propertiesMap
protected HashMap propertiesMap
The set of dynamic properties that are part of this DynaClass,
keyed by the property name. Individual descriptor instances will
be the same instances as those in the properties
list.
WrapDynaClass
private WrapDynaClass(Class beanClass)
Construct a new WrapDynaClass for the specified JavaBean class. This
constructor is private; WrapDynaClass instances will be created as
needed via calls to the createDynaClass(Class)
method.
beanClass
- JavaBean class to be introspected around
clear
public static void clear()
Clear our cache of WrapDynaClass instances.
createDynaClass
public static WrapDynaClass createDynaClass(Class beanClass)
Create (if necessary) and return a new WrapDynaClass
instance for the specified bean class.
beanClass
- Bean class for which a WrapDynaClass is requested
getDynaProperties
public DynaProperty[] getDynaProperties()
Return an array of
ProperyDescriptors
for the properties
currently defined in this DynaClass. If no properties are defined, a
zero-length array will be returned.
FIXME - Should we really be implementing
getBeanInfo()
instead, which returns property descriptors
and a bunch of other stuff?
- getDynaProperties in interface DynaClass
getDynaProperty
public DynaProperty getDynaProperty(String name)
Return a property descriptor for the specified property, if it exists;
otherwise, return null
.
- getDynaProperty in interface DynaClass
name
- Name of the dynamic property for which a descriptor
is requested
getName
public String getName()
Return the name of this DynaClass (analogous to the
getName()
method of java.lang.Class
DynaClass
implementation class to support
different dynamic classes, with different sets of properties.
- getName in interface DynaClass
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor(String name)
Return the PropertyDescriptor for the specified property name, if any;
otherwise return null
.
name
- Name of the property to be retrieved
introspect
protected void introspect()
Introspect our bean class to identify the supported properties.
newInstance
public DynaBean newInstance()
throws IllegalAccessException,
InstantiationException
Instantiates a new standard JavaBean instance associated with
this DynaClass and return it wrapped in a new WrapDynaBean
instance.
NOTE the JavaBean should have a
no argument constructor.
NOTE - Most common use cases should not need to use
this method. It is usually better to create new
WrapDynaBean
instances by calling its constructor.
For example:
Object javaBean = ...;
DynaBean wrapper = new WrapDynaBean(javaBean);
(This method is needed for some kinds of
DynaBean
framework.)
- newInstance in interface DynaClass
Copyright (c) 2001-2004 - Apache Software Foundation