org.apache.cayenne.reflect

## Class BeanAccessor

- java.lang.Object
- - org.apache.cayenne.reflect.BeanAccessor

- All Implemented Interfaces:
    Serializable, Accessor

      public class BeanAccessor
      extends Object
      implements Accessor

  A property accessor that uses set/get methods following JavaBean naming conventions.
  Since:
    1.2
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Object` | `nullValue`
    `protected String` | `propertyName`
    `protected Method` | `readMethod`
    `protected Method` | `writeMethod`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `BeanAccessor(Class<?> objectClass, String propertyName, Class<?> propertyType)`
    `protected` | `BeanAccessor(Class<?> objectClass, String propertyName, Class<?> propertyType, String booleanGetterName, String getterName, String setterName)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getName()` Returns property name.
    `Object` | `getValue(Object object)` Returns a property value of an object without disturbing the object fault status.
    `void` | `setValue(Object object, Object newValue)` Sets a property value of an object without disturbing the object fault status.

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

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

- - ### Field Detail

    - #### propertyName

          protected String propertyName

    - #### readMethod

          protected Method readMethod

    - #### writeMethod

          protected Method writeMethod

    - #### nullValue

          protected Object nullValue

  - ### Constructor Detail

    - #### BeanAccessor

          public BeanAccessor(Class<?> objectClass,
                              String propertyName,
                              Class<?> propertyType)

    - #### BeanAccessor

          protected BeanAccessor(Class<?> objectClass,
                                 String propertyName,
                                 Class<?> propertyType,
                                 String booleanGetterName,
                                 String getterName,
                                 String setterName)

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `Accessor`
      Returns property name.
      Specified by:
        `getName` in interface `Accessor`

    - #### getValue

          public Object getValue(Object object)
                          throws PropertyException

      Description copied from interface: `Accessor`
      Returns a property value of an object without disturbing the object fault status.
      Specified by:
        `getValue` in interface `Accessor`
      Throws:
        `PropertyException`
      Since:
        3.0

    - #### setValue

          public void setValue(Object object,
                               Object newValue)
                        throws PropertyException

      Description copied from interface: `Accessor`
      Sets a property value of an object without disturbing the object fault status. Old value of the property is specified as a hint.
      Specified by:
        `setValue` in interface `Accessor`
      Throws:
        `PropertyException`
      Since:
        3.0

Copyright © 2001–2021 Apache Cayenne. All rights reserved.