Class PropertyTypeDynaClass
- All Implemented Interfaces:
Serializable,org.apache.commons.beanutils.DynaClass,org.apache.commons.beanutils.MutableDynaClass
A DynaClass for the PropertyType which always returns
PropertyType as the type
for all properties.
- Author:
- Rob Gordon
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidAdd a new dynamic property with the specified data type, but with no restrictions on readability or writeability.voidAdd a new dynamic property with the specified data type, readability, and writeability.protected voidadd(org.apache.commons.beanutils.DynaProperty property) Add a new dynamic property.org.apache.commons.beanutils.DynaProperty[]org.apache.commons.beanutils.DynaPropertygetDynaProperty(String name) Return a property descriptor for the specified property.getName()booleanThis MutableDynaClass is never restricted.org.apache.commons.beanutils.DynaBeanvoidRemove the specified dynamic property, and any associated data type, readability, and writeability, from this dynamic class.voidsetRestricted(boolean restricted)
-
Constructor Details
-
PropertyTypeDynaClass
Constructor.- Parameters:
name- The name.
-
-
Method Details
-
isRestricted
public boolean isRestricted()This MutableDynaClass is never restricted.- Specified by:
isRestrictedin interfaceorg.apache.commons.beanutils.MutableDynaClass- See Also:
-
setRestricted
public void setRestricted(boolean restricted) - Specified by:
setRestrictedin interfaceorg.apache.commons.beanutils.MutableDynaClass
-
add
- Specified by:
addin interfaceorg.apache.commons.beanutils.MutableDynaClass
-
add
Add a new dynamic property with the specified data type, but with no restrictions on readability or writeability.- Specified by:
addin interfaceorg.apache.commons.beanutils.MutableDynaClass- Parameters:
name- Name of the new dynamic propertytype- Data type of the new dynamic property (null for no restrictions)- Throws:
IllegalArgumentException- if name is nullIllegalStateException- if this DynaClass is currently restricted, so no new properties can be added
-
add
Add a new dynamic property with the specified data type, readability, and writeability.
N.B.Support for readable/writeable properties has not been implemented and this method always throws a
UnsupportedOperationException.I'm not sure the intention of the original authors for this method, but it seems to me that readable/writable should be attributes of the
DynaPropertyclass (which they are not) and is the reason this method has not been implemented.- Specified by:
addin interfaceorg.apache.commons.beanutils.MutableDynaClass- Parameters:
name- Name of the new dynamic propertytype- Data type of the new dynamic property (null for no restrictions)readable- Set totrueif this property value should be readablewriteable- Set totrueif this property value should be writeable- Throws:
UnsupportedOperationException- anytime this method is called
-
add
protected void add(org.apache.commons.beanutils.DynaProperty property) Add a new dynamic property.- Parameters:
property- Property the new dynamic property to add.- Throws:
IllegalArgumentException- if name is nullIllegalStateException- if this DynaClass is currently restricted, so no new properties can be added
-
remove
Remove the specified dynamic property, and any associated data type, readability, and writeability, from this dynamic class. NOTE - This does NOT cause any corresponding property values to be removed from DynaBean instances associated with this DynaClass.- Specified by:
removein interfaceorg.apache.commons.beanutils.MutableDynaClass- Parameters:
name- Name of the dynamic property to remove- Throws:
IllegalArgumentException- if name is nullIllegalStateException- if this DynaClass is currently restricted, so no properties can be removed
-
getDynaProperty
Return a property descriptor for the specified property.
If the property is not found and the
returnNullindicator istrue, this method always returnsnull.If the property is not found and the
returnNullindicator isfalsea new property descriptor is created and returned (although its not actually added to the DynaClass's properties). This is the default beahviour.The reason for not returning a
nullproperty descriptor is thatBeanUtilsuses this method to check if a property exists before trying to set it - since these Lazy implementations automatically add any new properties when they are set, returningnullfrom this method would defeat their purpose.- Specified by:
getDynaPropertyin interfaceorg.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()- Specified by:
getDynaPropertiesin interfaceorg.apache.commons.beanutils.DynaClass
-
getName
- Specified by:
getNamein interfaceorg.apache.commons.beanutils.DynaClass
-
newInstance
public org.apache.commons.beanutils.DynaBean newInstance() throws IllegalAccessException, InstantiationException- Specified by:
newInstancein interfaceorg.apache.commons.beanutils.DynaClass- Throws:
IllegalAccessExceptionInstantiationException
-