Package: groovy.lang

## [Java] Class MetaProperty

- groovy.lang.MetaProperty

-     public abstract class MetaProperty
      extends Object

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

- - ### 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
    --- | --- | ---
    `` | `public static String` | `getGetterName(String propertyName, Class type)` Gets the name for the getter for this property
    `` | `public int` | `getModifiers()` Returns the access modifier.
    `` | `public String` | `getName()` Return the name of the property
    `` | `public abstract Object` | `getProperty(Object object)` Returns: the property of the given object
    `` | `public static String` | `getSetterName(String propertyName)` Gets the setter for the getter for this property.
    `` | `public Class` | `getType()` Returns: the type of the property
    `` | `public abstract 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` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 abstract Object getProperty(Object object)

      throws:
        RuntimeException 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 abstract 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