Groovy Documentation

## groovy.lang
[Java] Class MetaProperty

    java.lang.Object
      groovy.lang.MetaProperty

    public abstract class MetaProperty
    extends java.lang.Object

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

Authors:
  James Strachan

Version:
  \$Revision\$

Field Summary
`static java.lang.String` | `PROPERTY_SET_PREFIX`
`protected java.lang.String` | `name`
`protected java.lang.Class` | `type`

Constructor Summary
`MetaProperty(java.lang.String name, java.lang.Class type)`

Method Summary
`static java.lang.String` | `getGetterName(java.lang.String propertyName, java.lang.Class type)`
`int` | `getModifiers()`
`java.lang.String` | `getName()`
`java.lang.Object` | `getProperty(java.lang.Object object)` @return the property of the given object
`static java.lang.String` | `getSetterName(java.lang.String propertyName)`
`java.lang.Class` | `getType()` @return the type of the property
`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
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### PROPERTY_SET_PREFIX

    public static final java.lang.String PROPERTY_SET_PREFIX

### name

    protected final java.lang.String name

### type

    protected java.lang.Class type

Constructor Detail

### MetaProperty

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

Method Detail

### getGetterName

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

### getModifiers

    public int getModifiers()

### getName

    public java.lang.String getName()

### getProperty

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

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

### getSetterName

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

### getType

    public java.lang.Class getType()

  Returns:
    the type of the property

### setProperty

    public void setProperty(java.lang.Object object, java.lang.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

Groovy Documentation