Package groovy.lang

# Class MetaBeanProperty

java.lang.Object
groovy.lang.MetaProperty
groovy.lang.MetaBeanProperty

All Implemented Interfaces:
  `MetaMember`

Direct Known Subclasses:
  `MixinInstanceMetaProperty`, `ThreadManagedMetaBeanProperty`

public class MetaBeanProperty extends MetaProperty
Represents a property on a bean which may have a getter and/or a setter

- ## Field Summary

  ### Fields inherited from class groovy.lang.MetaProperty

  `name, PROPERTY_SET_PREFIX, type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MetaBeanProperty(String name, Class type, MetaMethod getter, MetaMethod setter)`
  Creates a bean-style meta property backed by optional accessor methods.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CachedField`
  `getField()`
  Gets the field of this property.
  `MetaMethod`
  `getGetter()`
  Gets the getter method of this property.
  `int`
  `getModifiers()`
  Gets the visibility modifiers of the property as defined by the getter, setter and field.
  `Object`
  `getProperty(Object object)`
  Gets the property of the given object.
  `MetaMethod`
  `getSetter()`
  Gets the setter method of this property.
  `void`
  `setField(CachedField field)`
  Sets the field of this property.
  `void`
  `setProperty(Object object, Object newValue)`
  Sets the property on the given object to the new value.

  ### Methods inherited from class groovy.lang.MetaProperty

  `getGetterName, getName, getSetterName, getType`

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

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

  ### Methods inherited from interface groovy.lang.MetaMember

  `isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic`

- ## Constructor Details

  - ### MetaBeanProperty

    public MetaBeanProperty(String name, Class type, MetaMethod getter, MetaMethod setter)
    Creates a bean-style meta property backed by optional accessor methods.
    Parameters:
      `name` - the Groovy property name
      `type` - the declared property type
      `getter` - the getter meta method, or `null`
      `setter` - the setter meta method, or `null`

- ## Method Details

  - ### getModifiers

    public int getModifiers()
    Gets the visibility modifiers of the property as defined by the getter, setter and field.
    Specified by:
      `getModifiers` in interface `MetaMember`
    Overrides:
      `getModifiers` in class `MetaProperty`
    Returns:
      `Modifier.PUBLIC`

  - ### getProperty

    public Object getProperty(Object object)
    Gets the property of the given object.
    Specified by:
      `getProperty` in class `MetaProperty`
    Parameters:
      `object` - which to be got
    Returns:
      the property of the given object
    Throws:
      `RuntimeException` - if the property could not be evaluated

  - ### setProperty

    public void setProperty(Object object, Object newValue)
    Sets the property on the given object to the new value.
    Specified by:
      `setProperty` in class `MetaProperty`
    Parameters:
      `object` - on which to set the property
      `newValue` - the new value of the property
    Throws:
      `RuntimeException` - if the property could not be set

  - ### getField

    public CachedField getField()
    Gets the field of this property.

  - ### getGetter

    public MetaMethod getGetter()
    Gets the getter method of this property.

  - ### getSetter

    public MetaMethod getSetter()
    Gets the setter method of this property.

  - ### setField

    public void setField(CachedField field)
    Sets the field of this property.