Package: org.codehaus.groovy.runtime.wrappers

## [Java] Class GroovyObjectWrapper

- org.codehaus.groovy.runtime.wrappers.GroovyObjectWrapper

-     public class GroovyObjectWrapper
      extends Wrapper

  Wraps an existing GroovyObject while constraining the type it should present to the runtime.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected GroovyObject` | `wrapped` | The wrapped Groovy object.

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Wrapper` | `constrainedType`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GroovyObjectWrapper(GroovyObject wrapped, Class constrainedType)` Creates a wrapper for a Groovy object constrained to the supplied type.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected MetaClass` | `getDelegatedMetaClass()` * Returns the meta class that should handle GroovyObject operations for the * wrapped value. * * Returns: the delegated meta class
    `` | `public Object` | `getProperty(String property)` Returns a property value from the wrapped Groovy object.
    `` | `protected Object` | `getWrapped()` * Returns the object used as the delegation target for meta-class-based * operations. * * Returns: the underlying wrapped object
    `` | `public Object` | `invokeMethod(String name, Object args)` Invokes a method on the wrapped Groovy object.
    `` | `public void` | `setMetaClass(MetaClass metaClass)` Updates the wrapped object's meta class.
    `` | `public void` | `setProperty(String property, Object newValue)` Sets a property on the wrapped Groovy object.
    `` | `public Object` | `unwrap()` * Returns the wrapped value. * * Returns: the underlying value represented by this wrapper

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Wrapper` | `getDelegatedMetaClass, getMetaClass, getType, getWrapped, unwrap`

- - ### Field Detail

    - #### protected final GroovyObject wrapped

      The wrapped Groovy object.

  - ### Constructor Detail

    - #### public GroovyObjectWrapper(GroovyObject wrapped, Class constrainedType)

      Creates a wrapper for a Groovy object constrained to the supplied type.

      Parameters:
        `wrapped` - the wrapped Groovy object
        `constrainedType` - the type the wrapped object should report

  - ### Method Detail

    - #### protected MetaClass getDelegatedMetaClass()

      * Returns the meta class that should handle GroovyObject operations for the * wrapped value. * *

      Returns:
        the delegated meta class

    - #### public Object getProperty(String property)

      Returns a property value from the wrapped Groovy object.

      Parameters:
        `property` - the property name
      Returns:
        the resolved property value

    - #### protected Object getWrapped()

      * Returns the object used as the delegation target for meta-class-based * operations. * *

      Returns:
        the underlying wrapped object

    - #### public Object invokeMethod(String name, Object args)

      Invokes a method on the wrapped Groovy object.

      Parameters:
        `name` - the method name
        `args` - the invocation arguments
      Returns:
        the invocation result

    - #### public void setMetaClass(MetaClass metaClass)

      Updates the wrapped object's meta class.

      Parameters:
        `metaClass` - the new meta class

    - #### public void setProperty(String property, Object newValue)

      Sets a property on the wrapped Groovy object.

      Parameters:
        `property` - the property name
        `newValue` - the new property value

    - #### public Object unwrap()

      * Returns the wrapped value. * *

      Returns:
        the underlying value represented by this wrapper