groovy.lang

## Class MetaProperty

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

Direct Known Subclasses:
  CachedField, MetaArrayLengthProperty, MetaBeanProperty, MetaExpandoProperty

    public abstract class MetaProperty
    extends Object

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

Version:
  $Revision: 14463 $
Author:
  James Strachan

### Field Summary

Fields
`protected String` `name`
`static String` `PROPERTY_SET_PREFIX`
`protected Class` `type`

### Constructor Summary

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

### Method Summary

Methods
`static String` `getGetterName(String propertyName, Class type)`
`int` `getModifiers()`
`String` `getName()`
`abstract Object` `getProperty(Object object)`
`static String` `getSetterName(String propertyName)`
`Class` `getType()`
`abstract void` `setProperty(Object object, 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 String name

#### type

    protected Class type

#### PROPERTY_SET_PREFIX

    public static final String PROPERTY_SET_PREFIX

See Also:
  Constant Field Values

### Constructor Detail

#### MetaProperty

    public MetaProperty(String name,
                Class type)

### Method Detail

#### getProperty

    public abstract Object getProperty(Object object)

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

#### setProperty

    public abstract void setProperty(Object object,
                   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:
  `RuntimeException` - if the property could not be set

#### getName

    public String getName()

#### getType

    public Class getType()

Returns:
  the type of the property

#### getModifiers

    public int getModifiers()

#### getGetterName

    public static String getGetterName(String propertyName,
                       Class type)

#### getSetterName

    public static String getSetterName(String propertyName)