BeanPropertySetter
Date: 2015-09-18

org.mockito.internal.util.reflection

## 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 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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `set(java.lang.Object value)` Set the value to the property represented by this `BeanPropertySetter`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 invoked
        `propertyField` - The field that should be accessed with the setter
        `reportNoSetterFound` - 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 invoked
        `propertyField` - 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 this `BeanPropertySetter`
      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, if `reportNoSetterFound` and setter could not be found.