org.oddjob.framework
Class WrapDynaClass

java.lang.Object
  extended by org.oddjob.framework.WrapDynaClass
All Implemented Interfaces:
Serializable, org.apache.commons.beanutils.DynaClass

public class WrapDynaClass
extends Object
implements org.apache.commons.beanutils.DynaClass, Serializable

Implementation of DynaClass for DynaBeans that wrap standard JavaBean instances.

Based on the BeanUtils version but Serializable, and also supports mapped types.

See Also:
Serialized Form
Author:
Rob Gorodon, based on the original from BeanUtils.

Method Summary
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.
 org.apache.commons.beanutils.DynaProperty[] getDynaProperties()
          Return an array of ProperyDescriptors for the properties currently defined in this DynaClass.
 org.apache.commons.beanutils.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.ClassDynaClass implementation class to support different dynamic classes, with different sets of properties.
protected  void introspect(Class<?> beanClass)
          Introspect our bean class to identify the supported properties.
 boolean isReadable(String propertyName)
           
 boolean isWritable(String propertyName)
           
 org.apache.commons.beanutils.DynaBean newInstance()
          Unsupported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()
Return the name of this DynaClass (analogous to the getName() method of java.lang.ClassDynaClass implementation class to support different dynamic classes, with different sets of properties.

Specified by:
getName in interface org.apache.commons.beanutils.DynaClass

getDynaProperty

public org.apache.commons.beanutils.DynaProperty getDynaProperty(String name)
Return a property descriptor for the specified property, if it exists; otherwise, return null.

Specified by:
getDynaProperty in interface org.apache.commons.beanutils.DynaClass
Parameters:
name - Name of the dynamic property for which a descriptor is requested
Throws:
IllegalArgumentException - if no property name is specified

getDynaProperties

public org.apache.commons.beanutils.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?

Specified by:
getDynaProperties in interface org.apache.commons.beanutils.DynaClass

newInstance

public org.apache.commons.beanutils.DynaBean newInstance()
                                                  throws UnsupportedOperationException
Unsupported.

Specified by:
newInstance in interface org.apache.commons.beanutils.DynaClass
Throws:
UnsupportedOperationException - Always.

isReadable

public boolean isReadable(String propertyName)

isWritable

public boolean isWritable(String propertyName)

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.

Parameters:
beanClass - Bean class for which a WrapDynaClass is requested

introspect

protected void introspect(Class<?> beanClass)
Introspect our bean class to identify the supported properties.