setProperty(name,value) in order to invoke setters on
the Object specified in the constructor. This class relies on reflection to
analyze the given Object Class.
Usage:
PropertySetter ps = new PropertySetter(anObject);
ps.set("name", "Joe");
ps.set("age", "32");
ps.set("isMale", "true");
will cause the invocations anObject.setName("Joe"), anObject.setAge(32), and
setMale(true) if such methods exist with those signatures. Otherwise an
PropertySetterException is thrown.
| Modifier and Type | Field and Description |
|---|---|
| protected final AggregationAssessor | |
| protected final BeanDescription | |
| protected final Object | |
| protected final Class |
| Access | Constructor and Description |
|---|---|
| public | PropertySetter(BeanDescriptionCache beanDescriptionCache, Object
the object for which to set properties obj)Create a new PropertySetter for the specified Object. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public AggregationType | |
| public Class | getClassNameViaImplicitRules(String name, AggregationType aggregationType, DefaultNestedComponentRegistry registry)
|
| public Object | |
| public Class | |
| pack-priv void | |
| private boolean | |
| public void | |
| public void | setContext(Context context)
Overrides ch. Implements ch. |
| public void | setProperty(String
name of the property name, String String value of the property value)Set a property on this PropertySetter's Object. |
| private void | setProperty(Method
A Method describing the characteristics of the
property to set. setter, String The value of the property. value)Set the named property using a |
| aggregationAssessor | back to summary |
|---|---|
| protected final AggregationAssessor aggregationAssessor | |
| beanDescription | back to summary |
|---|---|
| protected final BeanDescription beanDescription | |
| obj | back to summary |
|---|---|
| protected final Object obj | |
| objClass | back to summary |
|---|---|
| protected final Class<?> objClass | |
| PropertySetter | back to summary |
|---|---|
| public PropertySetter(BeanDescriptionCache beanDescriptionCache, Object obj) Create a new PropertySetter for the specified Object. This is done in
preparation for invoking
| |
| addBasicProperty | back to summary |
|---|---|
| public void addBasicProperty(String name, String strValue) | |
| addComplexProperty | back to summary |
|---|---|
| public void addComplexProperty(String name, Object complexProperty) | |
| computeAggregationType | back to summary |
|---|---|
| public AggregationType computeAggregationType(String name) | |
| getClassNameViaImplicitRules | back to summary |
|---|---|
| public Class | |
| getObj | back to summary |
|---|---|
| public Object getObj() | |
| getObjClass | back to summary |
|---|---|
| public Class | |
| invokeMethodWithSingleParameterOnThisObject | back to summary |
|---|---|
| pack-priv void invokeMethodWithSingleParameterOnThisObject(Method method, Object parameter) | |
| isSanityCheckSuccessful | back to summary |
|---|---|
| private boolean isSanityCheckSuccessful(String name, Method method, Class<?>[] params, Object complexProperty) | |
| setComplexProperty | back to summary |
|---|---|
| public void setComplexProperty(String name, Object complexProperty) | |
| setContext | back to summary |
|---|---|
| public void setContext(Context context) Overrides ch. Implements ch.
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String name, String value) Set a property on this PropertySetter's Object. If successful, this method will invoke a setter method on the underlying Object. The setter is the one for the specified property name and the value is determined partly from the setter argument type and partly from the value specified in the call to this method. If the setter expects a String no conversion is necessary. If it expects an int, then an attempt is made to convert 'value' to an int using new Integer(value). If the setter expects a boolean, the conversion is by new Boolean(value). | |
| setProperty | back to summary |
|---|---|
| private void setProperty(Method setter, String value) throws PropertySetterException Set the named property using a | |