Package org.apache.commons.beanutils2
Interface MutableDynaClass
- All Superinterfaces:
DynaClass
- All Known Implementing Classes:
LazyDynaClass,LazyDynaMap
A specialized extension to DynaClass that allows properties to be added or removed dynamically.
WARNING - No guarantees that this will be in the final APIs ... it's here primarily to preserve some concepts that were in the original proposal for further discussion.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new dynamic property with no restrictions on data type, readability, or writeability.voidAdd 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.booleanIs this DynaClass currently restricted, if so, no changes to the existing registration of property names, data types, readability, or writeability are allowed.voidRemove the specified dynamic property, and any associated data type, readability, and writeability, from this dynamic class.voidsetRestricted(boolean restricted) Sets the restricted state of this DynaClass to the specified value.Methods inherited from interface org.apache.commons.beanutils2.DynaClass
getDynaProperties, getDynaProperty, getName, newInstance
-
Method Details
-
add
Add a new dynamic property with no restrictions on data type, readability, or writeability.- Parameters:
name- Name of the new dynamic property- 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, but with no restrictions on readability or writeability.- 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.- 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 readablewritable- Set totrueif this property value should be writable- Throws:
IllegalArgumentException- if name is nullIllegalStateException- if this DynaClass is currently restricted, so no new properties can be added
-
isRestricted
boolean isRestricted()Is this DynaClass currently restricted, if so, no changes to the existing registration of property names, data types, readability, or writeability are allowed.- Returns:
trueif this MutableDynaClassis restricted, otherwisefalse
-
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.- 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
-
setRestricted
Sets the restricted state of this DynaClass to the specified value.- Parameters:
restricted- The new restricted state
-