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, java.lang.Object obj)`

  - ### Method Summary

    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(java.lang.reflect.Method method)` adds a new instance method to this MetaClass.
    `void` | `addNewStaticMethod(java.lang.reflect.Method method)` adds a new static method to this MetaClass.
    `boolean` | `equals(java.lang.Object obj)`
    `java.lang.Object` | `getProperty(java.lang.String property)` Retrieves a property value.
    `void` | `initialize()` complete the initialisation process.
    `java.lang.Object` | `invokeMethod(java.lang.String name, java.lang.Object args)` Invokes the given method.
    `GroovyObject` | `replaceDelegate()`
    `void` | `setProperty(java.lang.String property, java.lang.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,
                         java.lang.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 java.lang.Object invokeMethod(java.lang.String name,
                                      java.lang.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 java.lang.Object getProperty(java.lang.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(java.lang.String property,
                         java.lang.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(java.lang.reflect.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(java.lang.reflect.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(java.lang.Object obj)

      Overrides:
        `equals` in class `DelegatingMetaClass`