MetaProperty (groovy 2.4.9 API)
Date: 2017-02-24

Package: groovy.lang

## [Java] Class MetaProperty

- groovy.lang.MetaProperty

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

  Authors:
    James Strachan

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `PROPERTY_SET_PREFIX` |
    `protected String` | `name` |
    `protected Class` | `type` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `MetaProperty (String name, Class type)` Constructor that sets the property name and type (class)

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static String` | `getGetterName(String propertyName, Class type)` Gets the name for the getter for this property
    `` | `int` | `getModifiers()` Returns the access modifier.
    `` | `String` | `getName()` Return the name of the property
    `` | `Object` | `getProperty(Object object)` @return the property of the given object
    `` | `static String` | `getSetterName(String propertyName)` Gets the setter for the getter for this property.
    `` | `Class` | `getType()` @return the type of the property
    `` | `void` | `setProperty(Object object, Object newValue)` Sets the property on the given object to the new value

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final String PROPERTY_SET_PREFIX

    - #### protected final String name

    - #### protected Class type

  - ### Constructor Detail

    - #### public MetaProperty(String name, Class type)

      Constructor that sets the property name and type (class)

  - ### Method Detail

    - #### public static String getGetterName(String propertyName, Class type)

      Gets the name for the getter for this property

      Returns:
        The name of the property. The name is "get"+ the capitalized propertyName or, in the case of boolean values, "is" + the capitalized propertyName

    - #### public int getModifiers()

      Returns the access modifier.

      Returns:
        Modifier.PUBLIC

    - #### public String getName()

      Return the name of the property

      Returns:
        the name of the property

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

      throws:
        Exception if the property could not be evaluated
      Returns:
        the property of the given object

    - #### public static String getSetterName(String propertyName)

      Gets the setter for the getter for this property.

      Returns:
        The name of the property. The name is "set"+ the capitalized propertyName.

    - #### public Class getType()

      Returns:
        the type of the property

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

      Sets 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