Package: groovy.lang

## [Java] Class MetaProperty

- groovy.lang.MetaProperty

- All Implemented Interfaces and Traits:
    MetaMember

      public abstract class MetaProperty
      extends Object
      implements MetaMember

  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` | Prefix used when deriving setter names from Groovy property names.
    `protected String` | `name` | Property name as exposed through the Groovy MOP.
    `protected Class` | `type` | Declared property 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 modifiers.
    `` | `public String` | `getName()` Returns 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 ntypeame 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

      Prefix used when deriving setter names from Groovy property names.

    - #### protected final String name

      Property name as exposed through the Groovy MOP.

    - #### protected Class type

      Declared property 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 modifiers.

      Returns:
        Modifier.PUBLIC

    - #### public String getName()

      Returns 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 ntypeame of the property.

      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