Groovy Documentation

## org.codehaus.groovy.grails.commons.metaclass
[Java] Class GenericDynamicProperty

    java.lang.Object
      org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicProperty
          org.codehaus.groovy.grails.commons.metaclass.GenericDynamicProperty

    public class GenericDynamicProperty
    extends AbstractDynamicProperty

A generic dyanmic property for any type.

Authors:
  Graeme Rocher

Constructor Summary
`GenericDynamicProperty(java.lang.String propertyName, java.lang.Class type, java.lang.Object initialValue, boolean readOnly)` @param propertyName The name of the property
`GenericDynamicProperty(java.lang.String propertyName, java.lang.Class type, boolean readOnly)` @param propertyName The name of the property
`GenericDynamicProperty(java.lang.String propertyName, java.lang.Class type, FunctionCallback initialValueGenerator, boolean readOnly)` Variant that allows supply of a lazy-initialization function for the initial value.

Method Summary
`java.lang.Object` | `get(java.lang.Object object)`
`void` | `set(java.lang.Object object, java.lang.Object newValue)`

Methods inherited from class AbstractDynamicProperty
get, getPropertyName, isPropertyMatch, set

Constructor Detail

### GenericDynamicProperty

    public GenericDynamicProperty(java.lang.String propertyName, java.lang.Class type, java.lang.Object initialValue, boolean readOnly)

  Parameters:
    `propertyName` - The name of the property
    `type` - The type of the property
    `initialValue` - The initial value of the property
    `readOnly` - True for read-only property

### GenericDynamicProperty

    public GenericDynamicProperty(java.lang.String propertyName, java.lang.Class type, boolean readOnly)

  Parameters:
    `propertyName` - The name of the property
    `type` - The type of the property
    `readOnly` - True for read-only property

### GenericDynamicProperty

    public GenericDynamicProperty(java.lang.String propertyName, java.lang.Class type, FunctionCallback initialValueGenerator, boolean readOnly)

  Variant that allows supply of a lazy-initialization function for the initial value.

  This function is called only on the first access to the property for a given object, unless the function returns null in which case it will be called again if another request is made.

  Parameters:
    `propertyName` - The name of the property
    `type` - The type of the property
    `readOnly` - True for read-only property

Method Detail

### get

    @Override
    public java.lang.Object get(java.lang.Object object)

### set

    @Override
    public void set(java.lang.Object object, java.lang.Object newValue)

Groovy Documentation