Package groovy.lang

# Class ExpandoMetaClassCreationHandle

java.lang.Object
groovy.lang.MetaClassRegistry.MetaClassCreationHandle
groovy.lang.ExpandoMetaClassCreationHandle

public class ExpandoMetaClassCreationHandle extends MetaClassRegistry.MetaClassCreationHandle

A handle for the MetaClassRegistry that changes all classes loaded into the Grails VM to use ExpandoMetaClass instances

The handle should be registered with the Groovy runtime before Groovy loads, for example in your main method. `GroovySystem.metaClassRegistry.metaClassCreationHandle = new ExpandoMetaClassCreationHandle()`

Since:
  1.5
See Also:
  - `MetaClassRegistry`
  - `MetaClassRegistry.MetaClassCreationHandle`
  - `MetaClassRegistryImpl.setMetaClassCreationHandle(groovy.lang.MetaClassRegistry.MetaClassCreationHandle)`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ExpandoMetaClassCreationHandle`
  `instance`
  Shared creation handle instance used when expando meta classes are globally enabled.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExpandoMetaClassCreationHandle()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected MetaClass`
  `createNormalMetaClass(Class theClass, MetaClassRegistry registry)`
  Creates the standard meta class implementation for the supplied type.
  `static void`
  `disable()`
  Restores the default meta class creation handle for the Groovy runtime.
  `static void`
  `enable()`
  Enables the ExpandoMetaClassCreationHandle with the registry `ExpandoMetaClassCreationHandle.enable();`
  `boolean`
  `hasModifiedMetaClass(ExpandoMetaClass emc)`
  Checks whether the supplied expando meta class has been registered as modified.
  `void`
  `registerModifiedMetaClass(ExpandoMetaClass emc)`
  Registers a modified ExpandoMetaClass with the creation handle

  ### Methods inherited from class groovy.lang.MetaClassRegistry.MetaClassCreationHandle

  `create, isDisableCustomMetaClassLookup, setDisableCustomMetaClassLookup`

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

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

- ## Field Details

  - ### instance

    public static final ExpandoMetaClassCreationHandle instance
    Shared creation handle instance used when expando meta classes are globally enabled.

- ## Constructor Details

  - ### ExpandoMetaClassCreationHandle

    public ExpandoMetaClassCreationHandle()

- ## Method Details

  - ### createNormalMetaClass

    protected MetaClass createNormalMetaClass(Class theClass, MetaClassRegistry registry)
    Creates the standard meta class implementation for the supplied type.
    Overrides:
      `createNormalMetaClass` in class `MetaClassRegistry.MetaClassCreationHandle`
    Parameters:
      `theClass` - the class that requires a meta class
      `registry` - the registry creating the meta class
    Returns:
      the default meta class implementation for the type

  - ### registerModifiedMetaClass

    public void registerModifiedMetaClass(ExpandoMetaClass emc)
    Registers a modified ExpandoMetaClass with the creation handle
    Parameters:
      `emc` - The EMC

  - ### hasModifiedMetaClass

    public boolean hasModifiedMetaClass(ExpandoMetaClass emc)
    Checks whether the supplied expando meta class has been registered as modified.
    Parameters:
      `emc` - the expando meta class to inspect
    Returns:
      `true` if the class info retains a modified expando instance

  - ### enable

    public static void enable()

    Enables the ExpandoMetaClassCreationHandle with the registry `ExpandoMetaClassCreationHandle.enable();`

  - ### disable

    public static void disable()
    Restores the default meta class creation handle for the Groovy runtime.