public class BeanPropertySetter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.reflect.Field |
field |
private boolean |
reportNoSetterFound |
private static java.lang.String |
SET_PREFIX |
private java.lang.Object |
target |
Constructor and Description |
---|
BeanPropertySetter(java.lang.Object target,
java.lang.reflect.Field propertyField)
New BeanPropertySetter that don't report failure
|
BeanPropertySetter(java.lang.Object target,
java.lang.reflect.Field propertyField,
boolean reportNoSetterFound)
New BeanPropertySetter
|
Modifier and Type | Method and Description |
---|---|
private void |
reportNoSetterFound() |
boolean |
set(java.lang.Object value)
Set the value to the property represented by this
BeanPropertySetter |
private java.lang.String |
setterName(java.lang.String fieldName)
Retrieve the setter name from the field name.
|
private static final java.lang.String SET_PREFIX
private final java.lang.Object target
private final boolean reportNoSetterFound
private final java.lang.reflect.Field field
public BeanPropertySetter(java.lang.Object target, java.lang.reflect.Field propertyField, boolean reportNoSetterFound)
target
- The target on which the setter must be invokedpropertyField
- The field that should be accessed with the setterreportNoSetterFound
- Allow the set method to raise an Exception if the setter cannot be foundpublic BeanPropertySetter(java.lang.Object target, java.lang.reflect.Field propertyField)
target
- The target on which the setter must be invokedpropertyField
- The propertyField that must be accessed through a setterpublic boolean set(java.lang.Object value)
BeanPropertySetter
value
- the new value to pass to the property settertrue
if the value has been injected, false
otherwisejava.lang.RuntimeException
- Can be thrown if the setter threw an exception, if the setter is not accessible
or, if reportNoSetterFound
and setter could not be found.private java.lang.String setterName(java.lang.String fieldName)
Implementation is based on the code of java.beans.Introspector
.
fieldName
- the Field nameprivate void reportNoSetterFound()