groovy.lang

## Class MetaProperty

- java.lang.Object
- - groovy.lang.MetaProperty

- Direct Known Subclasses:
    CachedField, MetaArrayLengthProperty, MetaBeanProperty, MetaExpandoProperty

      public abstract class MetaProperty
      extends java.lang.Object

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `name`
    `static java.lang.String` | `PROPERTY_SET_PREFIX`
    `protected java.lang.Class` | `type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetaProperty(java.lang.String name, java.lang.Class type)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `getGetterName(java.lang.String propertyName, java.lang.Class type)`
    `int` | `getModifiers()`
    `java.lang.String` | `getName()`
    `abstract java.lang.Object` | `getProperty(java.lang.Object object)`
    `static java.lang.String` | `getSetterName(java.lang.String propertyName)`
    `java.lang.Class` | `getType()`
    `abstract void` | `setProperty(java.lang.Object object, java.lang.Object newValue)` Sets the property on the given object to the new value

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

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

- - ### Field Detail

    - #### name

          protected final java.lang.String name

    - #### type

          protected java.lang.Class type

    - #### PROPERTY_SET_PREFIX

          public static final java.lang.String PROPERTY_SET_PREFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MetaProperty

          public MetaProperty(java.lang.String name,
                      java.lang.Class type)

  - ### Method Detail

    - #### getProperty

          public abstract java.lang.Object getProperty(java.lang.Object object)

      Returns:
        the property of the given object
      Throws:
        `java.lang.Exception` - if the property could not be evaluated

    - #### setProperty

          public abstract void setProperty(java.lang.Object object,
                         java.lang.Object newValue)

      Sets the property on the given object to the new value
      Parameters:
        `object` - on which to set the property
        `newValue` - the new value of the property
      Throws:
        `java.lang.RuntimeException` - if the property could not be set

    - #### getName

          public java.lang.String getName()

    - #### getType

          public java.lang.Class getType()

      Returns:
        the type of the property

    - #### getModifiers

          public int getModifiers()

    - #### getGetterName

          public static java.lang.String getGetterName(java.lang.String propertyName,
                                       java.lang.Class type)

    - #### getSetterName

          public static java.lang.String getSetterName(java.lang.String propertyName)