Class WrapDynaClass
- All Implemented Interfaces:
- DynaClass
DynaClass to wrap standard JavaBean instances.
 
 This class should not usually need to be used directly to create new WrapDynaBean instances - it's usually better to call the WrapDynaBean
 constructor. For example:
 
Object javaBean = ...; DynaBean wrapper = new WrapDynaBean(javaBean);
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected HashMap<String, PropertyDescriptor> The set of PropertyDescriptors for this bean class, keyed by the property name.protected DynaProperty[]The set of dynamic properties that are part of this DynaClass.protected HashMap<String, DynaProperty> The set of dynamic properties that are part of this DynaClass, keyed by the property name.
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidclear()Clear our cache of WrapDynaClass instances.static WrapDynaClasscreateDynaClass(Class<?> beanClass) Create (if necessary) and return a newWrapDynaClassinstance for the specified bean class.static WrapDynaClasscreateDynaClass(Class<?> beanClass, PropertyUtilsBean pu) Create (if necessary) and return a newWrapDynaClassinstance for the specified bean class using the givenPropertyUtilsBeaninstance for introspection.protected Class<?> Gets the class of the underlying wrapped bean.Return an array ofPropertyDescriptorfor the properties currently defined in this DynaClass.getDynaProperty(String name) Gets a property descriptor for the specified property, if it exists; otherwise, returnnull.getName()Gets the name of this DynaClass (analogous to thegetName()method ofClass, which allows the sameDynaClassimplementation class to support different dynamic classes, with different sets of properties.getPropertyDescriptor(String name) Gets the PropertyDescriptor for the specified property name, if any; otherwise returnnull.protected PropertyUtilsBeanReturns thePropertyUtilsBeaninstance associated with this class.protected voidIntrospect our bean class to identify the supported properties.Instantiates a new standard JavaBean instance associated with this DynaClass and return it wrapped in a new WrapDynaBean instance.
- 
Field Details- 
descriptorsMapThe set of PropertyDescriptors for this bean class, keyed by the property name. Individual descriptor instances will be the same instances as those in thedescriptorslist.
- 
propertiesThe set of dynamic properties that are part of this DynaClass.
- 
propertiesMapThe 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 thepropertieslist.
 
- 
- 
Method Details- 
clearClear our cache of WrapDynaClass instances.
- 
createDynaClassCreate (if necessary) and return a newWrapDynaClassinstance for the specified bean class.- Parameters:
- beanClass- Bean class for which a WrapDynaClass is requested
- Returns:
- A new Wrap DynaClass
 
- 
createDynaClassCreate (if necessary) and return a newWrapDynaClassinstance for the specified bean class using the givenPropertyUtilsBeaninstance for introspection. Using this method a specially configuredPropertyUtilsBeaninstance can be hooked into the introspection mechanism of the managed bean. The argument is optional; if noPropertyUtilsBeanobject is provided, the default instance is used.- Parameters:
- beanClass- Bean class for which a WrapDynaClass is requested
- pu- the optional- PropertyUtilsBeanto be used for introspection
- Returns:
- A new Wrap DynaClass
- Since:
- 1.9
 
- 
getBeanClassGets the class of the underlying wrapped bean.- Returns:
- the class of the underlying wrapped bean
- Since:
- 1.8.0
 
- 
getDynaPropertiesReturn an array of PropertyDescriptorfor 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:
- getDynaPropertiesin interface- DynaClass
- Returns:
- the set of properties for this DynaClass
 
- 
getDynaPropertyGets a property descriptor for the specified property, if it exists; otherwise, returnnull.- Specified by:
- getDynaPropertyin interface- DynaClass
- Parameters:
- name- Name of the dynamic property for which a descriptor is requested
- Returns:
- The descriptor for the specified property
- Throws:
- IllegalArgumentException- if no property name is specified
 
- 
getNameGets the name of this DynaClass (analogous to thegetName()method ofClass, which allows the sameDynaClassimplementation class to support different dynamic classes, with different sets of properties.
- 
getPropertyDescriptorGets the PropertyDescriptor for the specified property name, if any; otherwise returnnull.- Parameters:
- name- Name of the property to be retrieved
- Returns:
- The descriptor for the specified property
 
- 
getPropertyUtilsBeanReturns thePropertyUtilsBeaninstance associated with this class. This bean is used for introspection.- Returns:
- the associated PropertyUtilsBeaninstance
- Since:
- 1.9
 
- 
introspectIntrospect our bean class to identify the supported properties.
- 
newInstanceInstantiates 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 WrapDynaBeaninstances by calling its constructor. For example:Object javaBean = ...; DynaBean wrapper = new WrapDynaBean(javaBean);(This method is needed for some kinds of DynaBeanframework.)- Specified by:
- newInstancein interface- DynaClass
- Returns:
- A new DynaBeaninstance
- Throws:
- IllegalAccessException- if the Class or the appropriate constructor is not accessible
- InstantiationException- if this Class represents an abstract class, an array class, a primitive type, or void; or if instantiation fails for some other reason
 
 
-