HandleMetaClass (Groovy 2.4.12)
Date: 2017-06-21

org.codehaus.groovy.runtime

## Class HandleMetaClass

- java.lang.Object
- - groovy.lang.DelegatingMetaClass
  - - org.codehaus.groovy.runtime.HandleMetaClass

- All Implemented Interfaces:
    GroovyObject, MetaClass, MetaObjectProtocol, MutableMetaClass

      public class HandleMetaClass
      extends DelegatingMetaClass

- - ### Field Summary

    - ### Fields inherited from class groovy.lang.DelegatingMetaClass

      `delegate`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HandleMetaClass(MetaClass mc)`
    `HandleMetaClass(MetaClass mc, Object obj)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMetaBeanProperty(MetaBeanProperty metaBeanProperty)` Adds a new MetaBeanProperty to the MetaClass
    `void` | `addMetaMethod(MetaMethod metaMethod)` Adds a new MetaMethod to the MetaClass
    `void` | `addNewInstanceMethod(Method method)` adds a new instance method to this MetaClass.
    `void` | `addNewStaticMethod(Method method)` adds a new static method to this MetaClass.
    `boolean` | `equals(Object obj)`
    `Object` | `getProperty(String property)` Retrieves a property value.
    `void` | `initialize()` Complete the initialisation process.
    `Object` | `invokeMethod(String name, Object args)` Invokes the given method.
    `GroovyObject` | `replaceDelegate()`
    `void` | `setProperty(String property, Object newValue)` Sets the given property to the new value.

    - ### Methods inherited from class groovy.lang.DelegatingMetaClass

      `getAdaptee, getAttribute, getAttribute, getClassNode, getMetaClass, getMetaMethod, getMetaMethods, getMetaProperty, getMethods, getProperties, getProperty, getProperty, getStaticMetaMethod, getStaticMetaMethod, getTheClass, hashCode, hasProperty, invokeConstructor, invokeMethod, invokeMethod, invokeMethod, invokeMissingMethod, invokeMissingProperty, invokeStaticMethod, isGroovyObject, isModified, pickMethod, respondsTo, respondsTo, selectConstructorAndTransformArguments, setAdaptee, setAttribute, setAttribute, setMetaClass, setProperty, setProperty, toString`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HandleMetaClass

          public HandleMetaClass(MetaClass mc)

    - #### HandleMetaClass

          public HandleMetaClass(MetaClass mc,
                                 Object obj)

  - ### Method Detail

    - #### initialize

          public void initialize()

      Description copied from interface: `MetaClass`
      Complete the initialisation process. After this method is called no methods should be added to the meta class. Invocation of methods or access to fields/properties is forbidden unless this method is called. This method should contain any initialisation code, taking a longer time to complete. An example is the creation of the Reflector. It is suggested to synchronize this method.
      Specified by:
        `initialize` in interface `MetaClass`
      Overrides:
        `initialize` in class `DelegatingMetaClass`

    - #### replaceDelegate

          public GroovyObject replaceDelegate()

    - #### invokeMethod

          public Object invokeMethod(String name,
                                     Object args)

      Description copied from interface: `GroovyObject`
      Invokes the given method.
      Specified by:
        `invokeMethod` in interface `GroovyObject`
      Overrides:
        `invokeMethod` in class `DelegatingMetaClass`
      Parameters:
        `name` - the name of the method to call
        `args` - the arguments to use for the method call
      Returns:
        the result of invoking the method

    - #### getProperty

          public Object getProperty(String property)

      Description copied from interface: `GroovyObject`
      Retrieves a property value.
      Specified by:
        `getProperty` in interface `GroovyObject`
      Overrides:
        `getProperty` in class `DelegatingMetaClass`
      Parameters:
        `property` - the name of the property of interest
      Returns:
        the given property

    - #### setProperty

          public void setProperty(String property,
                                  Object newValue)

      Description copied from interface: `GroovyObject`
      Sets the given property to the new value.
      Specified by:
        `setProperty` in interface `GroovyObject`
      Overrides:
        `setProperty` in class `DelegatingMetaClass`
      Parameters:
        `property` - the name of the property of interest
        `newValue` - the new value for the property

    - #### addNewInstanceMethod

          public void addNewInstanceMethod(Method method)

      Description copied from interface: `MutableMetaClass`
      adds a new instance method to this MetaClass. Instance methods are able to overwrite the original methods of the class. Calling this method should not be done after initialise was called.
      Specified by:
        `addNewInstanceMethod` in interface `MutableMetaClass`
      Overrides:
        `addNewInstanceMethod` in class `DelegatingMetaClass`
      Parameters:
        `method` - the method to be added

    - #### addNewStaticMethod

          public void addNewStaticMethod(Method method)

      Description copied from interface: `MutableMetaClass`
      adds a new static method to this MetaClass. This is only possible as long as initialise was not called.
      Specified by:
        `addNewStaticMethod` in interface `MutableMetaClass`
      Overrides:
        `addNewStaticMethod` in class `DelegatingMetaClass`
      Parameters:
        `method` - the method to be added

    - #### addMetaMethod

          public void addMetaMethod(MetaMethod metaMethod)

      Description copied from interface: `MutableMetaClass`
      Adds a new MetaMethod to the MetaClass
      Specified by:
        `addMetaMethod` in interface `MutableMetaClass`
      Overrides:
        `addMetaMethod` in class `DelegatingMetaClass`
      Parameters:
        `metaMethod` - The MetaMethod to add

    - #### addMetaBeanProperty

          public void addMetaBeanProperty(MetaBeanProperty metaBeanProperty)

      Description copied from interface: `MutableMetaClass`
      Adds a new MetaBeanProperty to the MetaClass
      Specified by:
        `addMetaBeanProperty` in interface `MutableMetaClass`
      Overrides:
        `addMetaBeanProperty` in class `DelegatingMetaClass`
      Parameters:
        `metaBeanProperty` - The MetaBeanProperty instance

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `DelegatingMetaClass`