Package: groovy.lang

## [Java] Class MetaBeanProperty

- groovy.lang.MetaBeanProperty

- Represents a property on a bean which may have a getter and/or a setter

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class MetaProperty` | `PROPERTY_SET_PREFIX, name, type`

  - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `CachedField` | `field`
    `Object` | `property`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `MetaBeanProperty (String name, Class type, MetaMethod getter, MetaMethod setter)` Sole constructor setting name, type (class), getter and setter.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `CachedField` | `getField()` Gets the field of this property
    `` | `MetaMethod` | `getGetter()` Get the getter method.
    `` | `int` | `getModifiers()` Gets the visibility modifiers for the property as defined by the getter and setter methods.
    `` | `Object` | `getProperty(Object object)` Get the property of the given object.
    `` | `MetaMethod` | `getSetter()` Get the setter method.
    `` | `void` | `setField(CachedField field)` Sets the field of this property
    `` | `void` | `setProperty(Object object, Object newValue)` Set the property on the given object to the new value.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class MetaProperty` | `getGetterName, getModifiers, getName, getProperty, getSetterName, getType, setProperty`

- - ### Property Detail

    - #### CachedField field

    - #### Object property

  - ### Constructor Detail

    - #### public MetaBeanProperty(String name, Class type, MetaMethod getter, MetaMethod setter)

      Sole constructor setting name, type (class), getter and setter.

  - ### Method Detail

    - #### public CachedField getField()

      Gets the field of this property

      Returns:
        The field of this property

    - #### public MetaMethod getGetter()

      Get the getter method.

      Returns:
        the getter method for this property.

    - #### public int getModifiers()

      Gets the visibility modifiers for the property as defined by the getter and setter methods.

      Returns:
        the visibility modifier of the getter, the setter, or both depending on which exist

    - #### public Object getProperty(Object object)

      Get the property of the given object.

      throws:
        RuntimeException if the property could not be evaluated
      Parameters:
        `object` - which to be got
      Returns:
        the property of the given object

    - #### public MetaMethod getSetter()

      Get the setter method.

      Returns:
        the setter method for this property.

    - #### public void setField(CachedField field)

      Sets the field of this property

      Parameters:
        field

    - #### public void setProperty(Object object, Object newValue)

      Set the property on the given object to the new value.

      throws:
        RuntimeException if the property could not be set
      Parameters:
        `object` - on which to set the property
        `newValue` - the new value of the property