Package org.codehaus.groovy.runtime.wrappers

# Class Wrapper

java.lang.Object
org.codehaus.groovy.runtime.wrappers.Wrapper

All Implemented Interfaces:
  `GroovyObject`

Direct Known Subclasses:
  `GroovyObjectWrapper`, `PojoWrapper`

public abstract class Wrapper extends Object implements GroovyObject
Base class for runtime wrappers that expose a value through `GroovyObject` while reporting a constrained type.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final Class`
  `constrainedType`
  The constrained type the wrapped value should present to the runtime.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Wrapper(Class constrainedType)`
  Creates a wrapper for values that should appear as the supplied type.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract MetaClass`
  `getDelegatedMetaClass()`
  Returns the meta class that should handle GroovyObject operations for the wrapped value.
  `MetaClass`
  `getMetaClass()`
  Returns the `MetaClass` used to service GroovyObject operations for the wrapped value.
  `Class`
  `getType()`
  Returns the constrained type associated with this wrapper.
  `protected abstract Object`
  `getWrapped()`
  Returns the object used as the delegation target for meta-class-based operations.
  `abstract Object`
  `unwrap()`
  Returns the wrapped value.

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

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

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

  `getProperty, invokeMethod, setMetaClass, setProperty`

- ## Field Details

  - ### constrainedType

    protected final Class constrainedType
    The constrained type the wrapped value should present to the runtime.

- ## Constructor Details

  - ### Wrapper

    public Wrapper(Class constrainedType)
    Creates a wrapper for values that should appear as the supplied type.
    Parameters:
      `constrainedType` - the type the wrapped value should report

- ## Method Details

  - ### getMetaClass

    public MetaClass getMetaClass()
    Returns the `MetaClass` used to service GroovyObject operations for the wrapped value.
    Specified by:
      `getMetaClass` in interface `GroovyObject`
    Returns:
      the delegated meta class

  - ### getType

    public Class getType()
    Returns the constrained type associated with this wrapper.
    Returns:
      the type the wrapped value should be treated as

  - ### unwrap

    public abstract Object unwrap()
    Returns the wrapped value.
    Returns:
      the underlying value represented by this wrapper

  - ### getWrapped

    protected abstract Object getWrapped()
    Returns the object used as the delegation target for meta-class-based operations.
    Returns:
      the underlying wrapped object

  - ### getDelegatedMetaClass

    protected abstract MetaClass getDelegatedMetaClass()
    Returns the meta class that should handle GroovyObject operations for the wrapped value.
    Returns:
      the delegated meta class