Class BeanPropertySetter
- java.lang.Object
-
- org.mockito.internal.util.reflection.BeanPropertySetter
-
public class BeanPropertySetter extends java.lang.Object
This utility class will call the setter of the property to inject a new value.
-
-
Constructor Summary
Constructors Constructor Description BeanPropertySetter(java.lang.Object target, java.lang.reflect.Field propertyField)
New BeanPropertySetter that don't report failureBeanPropertySetter(java.lang.Object target, java.lang.reflect.Field propertyField, boolean reportNoSetterFound)
New BeanPropertySetter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
set(java.lang.Object value)
Set the value to the property represented by thisBeanPropertySetter
-
-
-
Constructor Detail
-
BeanPropertySetter
public BeanPropertySetter(java.lang.Object target, java.lang.reflect.Field propertyField, boolean reportNoSetterFound)
New BeanPropertySetter- Parameters:
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 found
-
BeanPropertySetter
public BeanPropertySetter(java.lang.Object target, java.lang.reflect.Field propertyField)
New BeanPropertySetter that don't report failure- Parameters:
target
- The target on which the setter must be invokedpropertyField
- The propertyField that must be accessed through a setter
-
-
Method Detail
-
set
public boolean set(java.lang.Object value)
Set the value to the property represented by thisBeanPropertySetter
- Parameters:
value
- the new value to pass to the property setter- Returns:
true
if the value has been injected,false
otherwise- Throws:
java.lang.RuntimeException
- Can be thrown if the setter threw an exception, if the setter is not accessible or, ifreportNoSetterFound
and setter could not be found.
-
-