Package groovy.lang

# Class MetaClassImpl

java.lang.Object
groovy.lang.MetaClassImpl

All Implemented Interfaces:
  `MetaClass`, `MetaObjectProtocol`, `MutableMetaClass`

Direct Known Subclasses:
  `ClosureMetaClass`, `ExpandoMetaClass`, `ProxyMetaClass`

    public class MetaClassImpl
    extends java.lang.Object
    implements MetaClass, MutableMetaClass

Allows methods to be dynamically added to existing classes at runtime

See Also:
  `MetaClass`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `MetaClassImpl.Index` |
  `static class` | `MetaClassImpl.MetaConstructor` | This is a helper class introduced in Groovy 2.1.0, which is used only by indy.

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `static java.lang.Object[]` | `EMPTY_ARGUMENTS` |
  `protected MetaMethod` | `getPropertyMethod` |
  `protected static java.lang.String` | `INVOKE_METHOD_METHOD` |
  `protected MetaMethod` | `invokeMethodMethod` |
  `protected boolean` | `isGroovyObject` |
  `protected boolean` | `isMap` |
  `protected MetaMethodIndex` | `metaMethodIndex` |
  `protected static java.lang.String` | `METHOD_MISSING` |
  `protected static java.lang.String` | `PROPERTY_MISSING` |
  `protected MetaClassRegistry` | `registry` |
  `protected MetaMethod` | `setPropertyMethod` |
  `protected static java.lang.String` | `STATIC_METHOD_MISSING` |
  `protected static java.lang.String` | `STATIC_PROPERTY_MISSING` |
  `protected CachedClass` | `theCachedClass` |
  `protected java.lang.Class` | `theClass` |

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `MetaClassImpl​(MetaClassRegistry registry, java.lang.Class theClass)` | Constructor with registry setting methods to null
  `MetaClassImpl​(MetaClassRegistry registry, java.lang.Class theClass, MetaMethod[] add)` | Constructor with registry
  `MetaClassImpl​(java.lang.Class theClass)` | Constructor that sets the methods to null
  `MetaClassImpl​(java.lang.Class theClass, MetaMethod[] add)` | Constructor

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `addMetaBeanProperty​(MetaBeanProperty mp)` | Adds a new MetaBeanProperty to this MetaClass
  `void` | `addMetaMethod​(MetaMethod method)` | adds a MetaMethod to this class.
  `protected void` | `addMetaMethodToIndex​(MetaMethod method, MetaMethodIndex.Header header)` |
  `void` | `addNewInstanceMethod​(java.lang.reflect.Method method)` | Adds an instance method to this metaclass.
  `void` | `addNewStaticMethod​(java.lang.reflect.Method method)` | Adds a static method to this metaclass.
  `protected void` | `applyPropertyDescriptors​(java.beans.PropertyDescriptor[] propertyDescriptors)` |
  `protected void` | `checkIfGroovyObjectMethod​(MetaMethod metaMethod)` | Checks if the metaMethod is a method from the GroovyObject interface such as setProperty, getProperty and invokeMethod
  `protected void` | `checkInitalised()` | checks if the initialisation of the class id complete.
  `protected java.lang.Object` | `chooseMethod​(java.lang.String methodName, java.lang.Object methodOrList, java.lang.Class[] arguments)` | Chooses the correct method to use from a list of methods which match by name.
  `protected void` | `clearInvocationCaches()` | remove all method call cache entries.
  `CallSite` | `createConstructorSite​(CallSite site, java.lang.Object[] args)` | Create a CallSite
  `protected static java.lang.String` | `createErrorMessageForAmbiguity​(java.lang.String theClassName, java.lang.String name, java.lang.Class[] arguments, java.util.LinkedList matches)` |
  `CallSite` | `createPogoCallCurrentSite​(CallSite site, java.lang.Class sender, java.lang.Object[] args)` | Create a CallSite
  `CallSite` | `createPogoCallSite​(CallSite site, java.lang.Object[] args)` | Create a CallSite
  `CallSite` | `createPojoCallSite​(CallSite site, java.lang.Object receiver, java.lang.Object[] args)` | Create a CallSite
  `CallSite` | `createStaticSite​(CallSite site, java.lang.Object[] args)` | Create a CallSite
  `protected MetaMethod` | `createTransformMetaMethod​(MetaMethod method)` |
  `protected static java.lang.Object` | `doChooseMostSpecificParams​(java.lang.String theClassName, java.lang.String name, java.util.List matchingMethods, java.lang.Class[] arguments, boolean checkParametersCompatible)` |
  `protected void` | `dropMethodCache​(java.lang.String name)` |
  `protected void` | `dropStaticMethodCache​(java.lang.String name)` |
  `protected static MetaMethod` | `findMethodInClassHierarchy​(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass)` |
  `protected MetaMethod` | `findMixinMethod​(java.lang.String methodName, java.lang.Class[] arguments)` |
  `protected static MetaMethod` | `findOwnMethod​(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass, MetaMethod method)` |
  `protected MetaBeanProperty` | `findPropertyInClassHierarchy​(java.lang.String propertyName, CachedClass theClass)` |
  `MetaMethod[]` | `getAdditionalMetaMethods()` | Retrieves a list of additional MetaMethods held by this class
  `java.lang.Object` | `getAttribute​(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper)` | Retrieves the value of an attribute (field).
  `java.lang.Object` | `getAttribute​(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper, boolean fromInsideClass)` | Retrieves the value of an attribute (field).
  `java.lang.Object` | `getAttribute​(java.lang.Object object, java.lang.String attribute)` | Retrieves the value of an attribute (field).
  `ClassInfo` | `getClassInfo()` | Returns the ClassInfo for the contained Class
  `ClassNode` | `getClassNode()` | Obtains a reference to the original AST for the MetaClass if it is available at runtime
  `MetaProperty` | `getEffectiveGetMetaProperty​(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper)` |
  `MetaMethod` | `getMetaMethod​(java.lang.String name, java.lang.Object[] argTypes)` | Retrieves an instance MetaMethod for the given name and argument values, using the types of the argument values to establish the chosen MetaMethod
  `java.util.List<MetaMethod>` | `getMetaMethods()` | Retrieves the list of MetaMethods held by this class.
  `MetaProperty` | `getMetaProperty​(java.lang.String name)` | Returns a MetaProperty for the given name or null if it doesn't exist
  `java.util.List<MetaMethod>` | `getMethods()` | Retrieves the list of MetaMethods held by the class.
  `MetaMethod` | `getMethodWithCaching​(java.lang.Class sender, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper)` |
  `MetaMethod` | `getMethodWithoutCaching​(java.lang.Class sender, java.lang.String methodName, java.lang.Class[] arguments, boolean isCallToSuper)` |
  `java.util.List<MetaProperty>` | `getProperties()` | Get all the properties defined for this type
  `java.lang.Object` | `getProperty​(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper, boolean fromInsideClass)` | Retrieves a property on the given receiver for the specified arguments.
  `java.lang.Object` | `getProperty​(java.lang.Object object, java.lang.String property)` | Retrieves a property on the given object for the specified arguments.
  `MetaClassRegistry` | `getRegistry()` | Returns the registry for this metaclass
  `MetaMethod` | `getStaticMetaMethod​(java.lang.String name, java.lang.Object[] argTypes)` | Retrieves a static MetaMethod for the given name and argument values, using the types of the arguments to establish the chosen MetaMethod
  `protected java.lang.Object` | `getSubclassMetaMethods​(java.lang.String methodName)` |
  `protected java.util.LinkedList<CachedClass>` | `getSuperClasses()` |
  `CachedClass` | `getTheCachedClass()` | Returns the cached class for this metaclass
  `java.lang.Class` | `getTheClass()` | Returns the class this object this is the metaclass of.
  `int` | `getVersion()` | Returns version of the contained Class
  `protected static long` | `handleMatches​(long matchesDistance, java.util.LinkedList matches, java.lang.Object method, long dist)` |
  `boolean` | `hasCustomInvokeMethod()` | indicates is the meta class method invocation for non-static methods is done through a custom invoker object.
  `boolean` | `hasCustomStaticInvokeMethod()` | indicates is the meta class method invocation for static methods is done through a custom invoker object.
  `MetaProperty` | `hasProperty​(java.lang.Object obj, java.lang.String name)` | Returns true of the implementing MetaClass has a property of the given name
  `void` | `incVersion()` | Increments version of the contained Class
  `void` | `initialize()` | Complete the initialisation process.
  `java.lang.Object` | `invokeConstructor​(java.lang.Object[] arguments)` | Invokes a constructor for the given arguments.
  `java.lang.Object` | `invokeMethod​(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)` | Invokes a method on the given receiver for the specified arguments.
  `java.lang.Object` | `invokeMethod​(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)` | Invoke a method on the given object with the given arguments.
  `java.lang.Object` | `invokeMethod​(java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments)` | Invokes a method on the given receiver for the specified arguments.
  `java.lang.Object` | `invokeMissingMethod​(java.lang.Object instance, java.lang.String methodName, java.lang.Object[] arguments)` | Invoke a missing method on the given object with the given arguments.
  `java.lang.Object` | `invokeMissingProperty​(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)` | Invoke a missing property on the given object with the given arguments.
  `java.lang.Object` | `invokeStaticMethod​(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)` | Invokes a static method on the given Object with the given name and arguments.
  `protected java.lang.Object` | `invokeStaticMissingProperty​(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)` | Hook to deal with the case of MissingProperty for static properties.
  `boolean` | `isGroovyObject()` | Return whether the class represented by this metaclass instance is an instance of the GroovyObject class
  `protected boolean` | `isInitialized()` |
  `boolean` | `isModified()` | Returns whether this MetaClassImpl has been modified.
  `boolean` | `isPermissivePropertyAccess()` |
  `protected void` | `onGetPropertyFoundInHierarchy​(MetaMethod method)` |
  `protected void` | `onInvokeMethodFoundInHierarchy​(MetaMethod method)` |
  `protected void` | `onMixinMethodFound​(MetaMethod method)` |
  `protected void` | `onSetPropertyFoundInHierarchy​(MetaMethod method)` |
  `protected void` | `onSuperMethodFoundInHierarchy​(MetaMethod method)` |
  `protected void` | `onSuperPropertyFoundInHierarchy​(MetaBeanProperty property)` |
  `MetaMethod` | `pickMethod​(java.lang.String methodName, java.lang.Class[] arguments)` | Selects a method by name and argument classes.
  `protected void` | `reinitialize()` |
  `java.util.List` | `respondsTo​(java.lang.Object obj, java.lang.String name)` | Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of arguments.
  `java.util.List` | `respondsTo​(java.lang.Object obj, java.lang.String name, java.lang.Object[] argTypes)` | Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.
  `java.lang.reflect.Constructor` | `retrieveConstructor​(java.lang.Class[] arguments)` |
  `MetaMethod` | `retrieveConstructor​(java.lang.Object[] arguments)` | This is a helper method added in Groovy 2.1.0, which is used only by indy.
  `MetaMethod` | `retrieveStaticMethod​(java.lang.String methodName, java.lang.Object[] arguments)` |
  `int` | `selectConstructorAndTransformArguments​(int numberOfConstructors, java.lang.Object[] arguments)` | Internal method to support Groovy runtime.
  `void` | `setAttribute​(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)` | Sets an attribute on the given receiver for the specified arguments.
  `void` | `setAttribute​(java.lang.Object object, java.lang.String attribute, java.lang.Object newValue)` | Sets the value of an attribute (field).
  `protected void` | `setInitialized​(boolean initialized)` |
  `void` | `setPermissivePropertyAccess​(boolean permissivePropertyAccess)` |
  `void` | `setProperties​(java.lang.Object bean, java.util.Map map)` | Sets a number of bean properties from the given Map where the keys are the String names of properties and the values are the values of the properties to set
  `void` | `setProperty​(java.lang.Class sender, java.lang.Object object, java.lang.String name, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)` | Retrieves a property on the given receiver for the specified arguments.
  `void` | `setProperty​(java.lang.Object object, java.lang.String property, java.lang.Object newValue)` | Sets a property on the given object for the specified arguments.
  `java.lang.String` | `toString()` | Returns a string representation of this metaclass

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

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

- ## Field Details

  - ### EMPTY_ARGUMENTS

    public static final java.lang.Object[] EMPTY_ARGUMENTS

  - ### STATIC_METHOD_MISSING

    protected static final java.lang.String STATIC_METHOD_MISSING
    See Also:
      Constant Field Values

  - ### STATIC_PROPERTY_MISSING

    protected static final java.lang.String STATIC_PROPERTY_MISSING
    See Also:
      Constant Field Values

  - ### METHOD_MISSING

    protected static final java.lang.String METHOD_MISSING
    See Also:
      Constant Field Values

  - ### PROPERTY_MISSING

    protected static final java.lang.String PROPERTY_MISSING
    See Also:
      Constant Field Values

  - ### INVOKE_METHOD_METHOD

    protected static final java.lang.String INVOKE_METHOD_METHOD
    See Also:
      Constant Field Values

  - ### theClass

    protected final java.lang.Class theClass

  - ### theCachedClass

    protected final CachedClass theCachedClass

  - ### isGroovyObject

    protected final boolean isGroovyObject

  - ### isMap

    protected final boolean isMap

  - ### metaMethodIndex

    protected final MetaMethodIndex metaMethodIndex

  - ### getPropertyMethod

    protected MetaMethod getPropertyMethod

  - ### invokeMethodMethod

    protected MetaMethod invokeMethodMethod

  - ### setPropertyMethod

    protected MetaMethod setPropertyMethod

  - ### registry

    protected MetaClassRegistry registry

- ## Constructor Details

  - ### MetaClassImpl

    public MetaClassImpl​(java.lang.Class theClass, MetaMethod[] add)
    Constructor
    Parameters:
      `theClass` - The class this is the metaclass dor
      `add` - The methods for this class

  - ### MetaClassImpl

    public MetaClassImpl​(java.lang.Class theClass)
    Constructor that sets the methods to null
    Parameters:
      `theClass` - The class this is the metaclass dor

  - ### MetaClassImpl

    public MetaClassImpl​(MetaClassRegistry registry, java.lang.Class theClass, MetaMethod[] add)
    Constructor with registry
    Parameters:
      `registry` - The metaclass registry for this MetaClass
      `theClass` - The class
      `add` - The methods

  - ### MetaClassImpl

    public MetaClassImpl​(MetaClassRegistry registry, java.lang.Class theClass)
    Constructor with registry setting methods to null
    Parameters:
      `registry` - The metaclass registry for this MetaClass
      `theClass` - The class

- ## Method Details

  - ### getTheCachedClass

    public final CachedClass getTheCachedClass()
    Returns the cached class for this metaclass
    Returns:
      The cached class.

  - ### getRegistry

    public MetaClassRegistry getRegistry()
    Returns the registry for this metaclass
    Returns:
      The registry

  - ### respondsTo

    public java.util.List respondsTo​(java.lang.Object obj, java.lang.String name, java.lang.Object[] argTypes)
    Description copied from interface: `MetaObjectProtocol`

    Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types.

    Note that this method's return value is based on realised methods and does not take into account objects or classes that implement invokeMethod or methodMissing

    This method is "safe" in that it will always return a value and never throw an exception

    Specified by:
      `respondsTo` in interface `MetaObjectProtocol`
    Parameters:
      `obj` - The object to inspect
      `name` - The name of the method of interest
      `argTypes` - The argument types to match against
    Returns:
      A List of MetaMethods matching the argument types which will be empty if no matching methods exist
    See Also:
      `MetaObjectProtocol.respondsTo(Object, String, Object[])`

  - ### respondsTo

    public java.util.List respondsTo​(java.lang.Object obj, java.lang.String name)
    Description copied from interface: `MetaObjectProtocol`

    Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of arguments. In other words this method will return for foo() and foo(String).

    Note that this method's return value is based on realised methods and does not take into account objects or classes that implement invokeMethod or methodMissing

    This method is "safe" in that it will always return a value and never throw an exception

    Specified by:
      `respondsTo` in interface `MetaObjectProtocol`
    Parameters:
      `obj` - The object to inspect
      `name` - The name of the method of interest
    Returns:
      A List of MetaMethods which will be empty if no methods with the given name exist
    See Also:
      `MetaObjectProtocol.respondsTo(Object, String)`

  - ### hasProperty

    public MetaProperty hasProperty​(java.lang.Object obj, java.lang.String name)
    Description copied from interface: `MetaObjectProtocol`

    Returns true of the implementing MetaClass has a property of the given name

    Note that this method will only return true for realised properties and does not take into account implementation of getProperty or propertyMissing

    Specified by:
      `hasProperty` in interface `MetaObjectProtocol`
    Parameters:
      `obj` - The object to inspect
      `name` - The name of the property
    Returns:
      The MetaProperty or null if it doesn't exist
    See Also:
      `MetaObjectProtocol.hasProperty(Object, String)`

  - ### getMetaProperty

    public MetaProperty getMetaProperty​(java.lang.String name)
    Description copied from interface: `MetaObjectProtocol`
    Returns a MetaProperty for the given name or null if it doesn't exist
    Specified by:
      `getMetaProperty` in interface `MetaObjectProtocol`
    Parameters:
      `name` - The name of the MetaProperty
    Returns:
      A MetaProperty or null
    See Also:
      `MetaObjectProtocol.getMetaProperty(String)`

  - ### getStaticMetaMethod

    public MetaMethod getStaticMetaMethod​(java.lang.String name, java.lang.Object[] argTypes)
    Description copied from interface: `MetaObjectProtocol`
    Retrieves a static MetaMethod for the given name and argument values, using the types of the arguments to establish the chosen MetaMethod
    Specified by:
      `getStaticMetaMethod` in interface `MetaObjectProtocol`
    Parameters:
      `name` - The name of the MetaMethod
      `argTypes` - The argument types
    Returns:
      A MetaMethod or null if it doesn't exist
    See Also:
      `MetaObjectProtocol.getStaticMetaMethod(String, Object[])`

  - ### getMetaMethod

    public MetaMethod getMetaMethod​(java.lang.String name, java.lang.Object[] argTypes)
    Description copied from interface: `MetaObjectProtocol`
    Retrieves an instance MetaMethod for the given name and argument values, using the types of the argument values to establish the chosen MetaMethod
    Specified by:
      `getMetaMethod` in interface `MetaObjectProtocol`
    Parameters:
      `name` - The name of the MetaMethod
      `argTypes` - Array containing - 1) the argument values (using which their types are then inferred), or 2) the corresponding argument types
    Returns:
      A MetaMethod or null if it doesn't exist
    See Also:
      `MetaObjectProtocol.getMetaMethod(String, Object[])`

  - ### getTheClass

    public java.lang.Class getTheClass()
    Returns the class this object this is the metaclass of.
    Specified by:
      `getTheClass` in interface `MetaObjectProtocol`
    Returns:
      The class contained by this metaclass

  - ### isGroovyObject

    public boolean isGroovyObject()
    Return whether the class represented by this metaclass instance is an instance of the GroovyObject class
    Returns:
      true if this is a groovy class, false otherwise.

  - ### getSuperClasses

    protected java.util.LinkedList<CachedClass> getSuperClasses()

  - ### isModified

    public boolean isModified()
    Returns whether this MetaClassImpl has been modified. Since MetaClassImpl is not designed for modification this method always returns false
    Specified by:
      `isModified` in interface `MutableMetaClass`
    Returns:
      false

  - ### addNewInstanceMethod

    public void addNewInstanceMethod​(java.lang.reflect.Method method)
    Adds an instance method to this metaclass.
    Specified by:
      `addNewInstanceMethod` in interface `MutableMetaClass`
    Parameters:
      `method` - The method to be added

  - ### addNewStaticMethod

    public void addNewStaticMethod​(java.lang.reflect.Method method)
    Adds a static method to this metaclass.
    Specified by:
      `addNewStaticMethod` in interface `MutableMetaClass`
    Parameters:
      `method` - The method to be added

  - ### invokeMethod

    public java.lang.Object invokeMethod​(java.lang.Object object, java.lang.String methodName, java.lang.Object arguments)
    Invoke a method on the given object with the given arguments.
    Specified by:
      `invokeMethod` in interface `MetaObjectProtocol`
    Parameters:
      `object` - The object the method should be invoked on.
      `methodName` - The name of the method to invoke.
      `arguments` - The arguments to the invoked method as null, a Tuple, an array or a single argument of any type.
    Returns:
      The result of the method invocation.
    See Also:
      `MetaObjectProtocol.invokeMethod(Object, String, Object[])`

  - ### invokeMissingMethod

    public java.lang.Object invokeMissingMethod​(java.lang.Object instance, java.lang.String methodName, java.lang.Object[] arguments)
    Invoke a missing method on the given object with the given arguments.
    Specified by:
      `invokeMissingMethod` in interface `MetaClass`
    Parameters:
      `instance` - The object the method should be invoked on.
      `methodName` - The name of the method to invoke.
      `arguments` - The arguments to the invoked method.
    Returns:
      The result of the method invocation.
    See Also:
      `MissingMethodException`

  - ### invokeMissingProperty

    public java.lang.Object invokeMissingProperty​(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
    Invoke a missing property on the given object with the given arguments.
    Specified by:
      `invokeMissingProperty` in interface `MetaClass`
    Parameters:
      `instance` - The object the method should be invoked on.
      `propertyName` - The name of the property to invoke.
      `optionalValue` - The (optional) new value for the property
      `isGetter` - Whether the method is a getter
    Returns:
      The result of the method invocation.

  - ### onSuperPropertyFoundInHierarchy

    protected void onSuperPropertyFoundInHierarchy​(MetaBeanProperty property)

  - ### onMixinMethodFound

    protected void onMixinMethodFound​(MetaMethod method)

  - ### onSuperMethodFoundInHierarchy

    protected void onSuperMethodFoundInHierarchy​(MetaMethod method)

  - ### onInvokeMethodFoundInHierarchy

    protected void onInvokeMethodFoundInHierarchy​(MetaMethod method)

  - ### onSetPropertyFoundInHierarchy

    protected void onSetPropertyFoundInHierarchy​(MetaMethod method)

  - ### onGetPropertyFoundInHierarchy

    protected void onGetPropertyFoundInHierarchy​(MetaMethod method)

  - ### invokeStaticMissingProperty

    protected java.lang.Object invokeStaticMissingProperty​(java.lang.Object instance, java.lang.String propertyName, java.lang.Object optionalValue, boolean isGetter)
    Hook to deal with the case of MissingProperty for static properties. The method will look attempt to look up "propertyMissing" handlers and invoke them otherwise thrown a MissingPropertyException
    Parameters:
      `instance` - The instance
      `propertyName` - The name of the property
      `optionalValue` - The value in the case of a setter
      `isGetter` - True if its a getter
    Returns:
      The value in the case of a getter or a MissingPropertyException

  - ### invokeMethod

    public java.lang.Object invokeMethod​(java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments)
    Invokes a method on the given receiver for the specified arguments. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.
    Specified by:
      `invokeMethod` in interface `MetaObjectProtocol`
    Parameters:
      `object` - The object which the method was invoked on
      `methodName` - The name of the method
      `originalArguments` - The arguments to the method
    Returns:
      The return value of the method
    See Also:
      `MetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean)`

  - ### invokeMethod

    public java.lang.Object invokeMethod​(java.lang.Class sender, java.lang.Object object, java.lang.String methodName, java.lang.Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)

    Invokes a method on the given receiver for the specified arguments. The sender is the class that invoked the method on the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

    The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

    Specified by:
      `invokeMethod` in interface `MetaClass`
    Parameters:
      `sender` - The java.lang.Class instance that invoked the method
      `object` - The object which the method was invoked on
      `methodName` - The name of the method
      `originalArguments` - The arguments to the method
      `isCallToSuper` - Whether the method is a call to a super class method
      `fromInsideClass` - Whether the call was invoked from the inside or the outside of the class
    Returns:
      The return value of the method
    See Also:
      `MetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean)`

  - ### createTransformMetaMethod

    protected MetaMethod createTransformMetaMethod​(MetaMethod method)

  - ### getMethodWithCaching

    public MetaMethod getMethodWithCaching​(java.lang.Class sender, java.lang.String methodName, java.lang.Object[] arguments, boolean isCallToSuper)

  - ### retrieveConstructor

    public java.lang.reflect.Constructor retrieveConstructor​(java.lang.Class[] arguments)

  - ### retrieveStaticMethod

    public MetaMethod retrieveStaticMethod​(java.lang.String methodName, java.lang.Object[] arguments)

  - ### getMethodWithoutCaching

    public MetaMethod getMethodWithoutCaching​(java.lang.Class sender, java.lang.String methodName, java.lang.Class[] arguments, boolean isCallToSuper)

  - ### invokeStaticMethod

    public java.lang.Object invokeStaticMethod​(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments)
    Description copied from interface: `MetaObjectProtocol`
    Invokes a static method on the given Object with the given name and arguments.

    The Object can either be an instance of the class that this MetaObjectProtocol instance applies to or the java.lang.Class instance itself. If a method cannot be invoked a MissingMethodException is will be thrown

    Specified by:
      `invokeStaticMethod` in interface `MetaObjectProtocol`
    Parameters:
      `object` - An instance of the class returned by the getTheClass() method or the class itself
      `methodName` - The name of the method
      `arguments` - The arguments to the method
    Returns:
      The return value of the method which is null if the return type is void
    See Also:
      `MissingMethodException`

  - ### invokeConstructor

    public java.lang.Object invokeConstructor​(java.lang.Object[] arguments)
    Description copied from interface: `MetaObjectProtocol`
    Invokes a constructor for the given arguments. The MetaClass will attempt to pick the best argument which matches the types of the objects passed within the arguments array
    Specified by:
      `invokeConstructor` in interface `MetaObjectProtocol`
    Parameters:
      `arguments` - The arguments to the constructor
    Returns:
      An instance of the java.lang.Class that this MetaObjectProtocol object applies to

  - ### selectConstructorAndTransformArguments

    public int selectConstructorAndTransformArguments​(int numberOfConstructors, java.lang.Object[] arguments)
    Description copied from interface: `MetaClass`
    Internal method to support Groovy runtime. Not for client usage.
    Specified by:
      `selectConstructorAndTransformArguments` in interface `MetaClass`
    Parameters:
      `numberOfConstructors` - The number of constructors
      `arguments` - The arguments
    Returns:
      selected index

  - ### checkInitalised

    protected void checkInitalised()
    checks if the initialisation of the class id complete. This method should be called as a form of assert, it is no way to test if there is still initialisation work to be done. Such logic must be implemented in a different way.
    Throws:
      `java.lang.IllegalStateException` - if the initialisation is incomplete yet

  - ### retrieveConstructor

    public MetaMethod retrieveConstructor​(java.lang.Object[] arguments)
    This is a helper method added in Groovy 2.1.0, which is used only by indy. This method is for internal use only.
    Since:
      Groovy 2.1.0

  - ### setProperties

    public void setProperties​(java.lang.Object bean, java.util.Map map)
    Sets a number of bean properties from the given Map where the keys are the String names of properties and the values are the values of the properties to set

  - ### getProperty

    public java.lang.Object getProperty​(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper, boolean fromInsideClass)
    Description copied from interface: `MetaClass`

    Retrieves a property on the given receiver for the specified arguments. The sender is the class that is requesting the property from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

    The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

    Specified by:
      `getProperty` in interface `MetaClass`
    Parameters:
      `sender` - The java.lang.Class instance that requested the property
      `object` - The Object which the property is being retrieved from
      `name` - The name of the property
      `useSuper` - Whether the call is to a super class property
      `fromInsideClass` - ??
    Returns:
      the given property's value on the object

  - ### getEffectiveGetMetaProperty

    public MetaProperty getEffectiveGetMetaProperty​(java.lang.Class sender, java.lang.Object object, java.lang.String name, boolean useSuper)

  - ### getProperties

    public java.util.List<MetaProperty> getProperties()
    Get all the properties defined for this type
    Specified by:
      `getProperties` in interface `MetaClass`
    Specified by:
      `getProperties` in interface `MetaObjectProtocol`
    Returns:
      a list of MetaProperty objects
    See Also:
      `MetaProperty`

  - ### applyPropertyDescriptors

    protected void applyPropertyDescriptors​(java.beans.PropertyDescriptor[] propertyDescriptors)

  - ### addMetaBeanProperty

    public void addMetaBeanProperty​(MetaBeanProperty mp)
    Adds a new MetaBeanProperty to this MetaClass
    Specified by:
      `addMetaBeanProperty` in interface `MutableMetaClass`
    Parameters:
      `mp` - The MetaBeanProperty

  - ### setProperty

    public void setProperty​(java.lang.Class sender, java.lang.Object object, java.lang.String name, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)

    Retrieves a property on the given receiver for the specified arguments. The sender is the class that is requesting the property from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

    The useSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

    Specified by:
      `setProperty` in interface `MetaClass`
    Parameters:
      `sender` - The java.lang.Class instance that is mutating the property
      `object` - The Object which the property is being set on
      `name` - The name of the property
      `newValue` - The new value of the property to set
      `useSuper` - Whether the call is to a super class property
      `fromInsideClass` - Whether the call was invoked from the inside or the outside of the class.

  - ### getAttribute

    public java.lang.Object getAttribute​(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper)
    Retrieves the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.
    Specified by:
      `getAttribute` in interface `MetaClass`
    Parameters:
      `sender` - The class of the object that requested the attribute
      `object` - The instance
      `attribute` - The name of the attribute
      `useSuper` - Whether to look-up on the super class or not
    Returns:
      The attribute value

  - ### getAttribute

    public java.lang.Object getAttribute​(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, boolean useSuper, boolean fromInsideClass)
    Retrieves the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.
    Parameters:
      `sender` - The class of the object that requested the attribute
      `object` - The instance the attribute is to be retrieved from
      `attribute` - The name of the attribute
      `useSuper` - Whether to look-up on the super class or not
      `fromInsideClass` - Whether the call was invoked from the inside or the outside of the class.
    Returns:
      The attribute value

  - ### setAttribute

    public void setAttribute​(java.lang.Class sender, java.lang.Object object, java.lang.String attribute, java.lang.Object newValue, boolean useSuper, boolean fromInsideClass)

    Sets an attribute on the given receiver for the specified arguments. The sender is the class that is setting the attribute from the object. The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.

    The isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly to the super class if necessary

    Specified by:
      `setAttribute` in interface `MetaClass`
    Parameters:
      `sender` - The java.lang.Class instance that is mutating the property
      `object` - The Object which the property is being set on
      `attribute` - The name of the attribute,
      `newValue` - The new value of the attribute to set
      `useSuper` - Whether the call is to a super class property
      `fromInsideClass` - Whether the call was invoked from the inside or the outside of the class

  - ### getClassNode

    public ClassNode getClassNode()
    Obtains a reference to the original AST for the MetaClass if it is available at runtime
    Specified by:
      `getClassNode` in interface `MetaClass`
    Returns:
      The original AST or null if it cannot be returned

  - ### toString

    public java.lang.String toString()
    Returns a string representation of this metaclass
    Overrides:
      `toString` in class `java.lang.Object`

  - ### addMetaMethod

    public void addMetaMethod​(MetaMethod method)
    adds a MetaMethod to this class. WARNING: this method will not do the neccessary steps for multimethod logic and using this method doesn't mean, that a method added here is replacing another method from a parent class completely. These steps are usually done by initialize, which means if you need these steps, you have to add the method before running initialize the first time.
    Specified by:
      `addMetaMethod` in interface `MutableMetaClass`
    Parameters:
      `method` - the MetaMethod
    See Also:
      `initialize()`

  - ### addMetaMethodToIndex

    protected void addMetaMethodToIndex​(MetaMethod method, MetaMethodIndex.Header header)

  - ### checkIfGroovyObjectMethod

    protected final void checkIfGroovyObjectMethod​(MetaMethod metaMethod)
    Checks if the metaMethod is a method from the GroovyObject interface such as setProperty, getProperty and invokeMethod
    Parameters:
      `metaMethod` - The metaMethod instance
    See Also:
      `GroovyObject`

  - ### isInitialized

    protected boolean isInitialized()

  - ### setInitialized

    protected void setInitialized​(boolean initialized)

  - ### chooseMethod

    protected java.lang.Object chooseMethod​(java.lang.String methodName, java.lang.Object methodOrList, java.lang.Class[] arguments)
    Chooses the correct method to use from a list of methods which match by name.
    Parameters:
      `methodOrList` - the possible methods to choose from
      `arguments` - the arguments

  - ### doChooseMostSpecificParams

    protected static java.lang.Object doChooseMostSpecificParams​(java.lang.String theClassName, java.lang.String name, java.util.List matchingMethods, java.lang.Class[] arguments, boolean checkParametersCompatible)

  - ### createErrorMessageForAmbiguity

    protected static java.lang.String createErrorMessageForAmbiguity​(java.lang.String theClassName, java.lang.String name, java.lang.Class[] arguments, java.util.LinkedList matches)

  - ### handleMatches

    protected static long handleMatches​(long matchesDistance, java.util.LinkedList matches, java.lang.Object method, long dist)

  - ### initialize

    public void initialize()
    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`

  - ### reinitialize

    protected void reinitialize()

  - ### getMethods

    public java.util.List<MetaMethod> getMethods()
    Retrieves the list of MetaMethods held by the class. This list does not include MetaMethods added by groovy.lang.ExpandoMetaClass.
    Specified by:
      `getMethods` in interface `MetaClass`
    Specified by:
      `getMethods` in interface `MetaObjectProtocol`
    Returns:
      A list of MetaMethods
    See Also:
      `MetaMethod`

  - ### getMetaMethods

    public java.util.List<MetaMethod> getMetaMethods()
    Retrieves the list of MetaMethods held by this class. This list includes MetaMethods added by groovy.lang.ExpandoMetaClass.
    Specified by:
      `getMetaMethods` in interface `MetaClass`
    Returns:
      A list of MetaMethods

  - ### dropStaticMethodCache

    protected void dropStaticMethodCache​(java.lang.String name)

  - ### dropMethodCache

    protected void dropMethodCache​(java.lang.String name)

  - ### createPojoCallSite

    public CallSite createPojoCallSite​(CallSite site, java.lang.Object receiver, java.lang.Object[] args)
    Create a CallSite

  - ### createStaticSite

    public CallSite createStaticSite​(CallSite site, java.lang.Object[] args)
    Create a CallSite

  - ### createPogoCallSite

    public CallSite createPogoCallSite​(CallSite site, java.lang.Object[] args)
    Create a CallSite

  - ### createPogoCallCurrentSite

    public CallSite createPogoCallCurrentSite​(CallSite site, java.lang.Class sender, java.lang.Object[] args)
    Create a CallSite

  - ### createConstructorSite

    public CallSite createConstructorSite​(CallSite site, java.lang.Object[] args)
    Create a CallSite

  - ### getClassInfo

    public ClassInfo getClassInfo()
    Returns the ClassInfo for the contained Class
    Returns:
      The ClassInfo for the contained class.

  - ### getVersion

    public int getVersion()
    Returns version of the contained Class
    Returns:
      The version of the contained class.

  - ### incVersion

    public void incVersion()
    Increments version of the contained Class

  - ### getAdditionalMetaMethods

    public MetaMethod[] getAdditionalMetaMethods()
    Retrieves a list of additional MetaMethods held by this class
    Returns:
      A list of MetaMethods

  - ### findPropertyInClassHierarchy

    protected MetaBeanProperty findPropertyInClassHierarchy​(java.lang.String propertyName, CachedClass theClass)

  - ### findMixinMethod

    protected MetaMethod findMixinMethod​(java.lang.String methodName, java.lang.Class[] arguments)

  - ### findMethodInClassHierarchy

    protected static MetaMethod findMethodInClassHierarchy​(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass)

  - ### findOwnMethod

    protected static MetaMethod findOwnMethod​(java.lang.Class instanceKlazz, java.lang.String methodName, java.lang.Class[] arguments, MetaClass metaClass, MetaMethod method)

  - ### getSubclassMetaMethods

    protected java.lang.Object getSubclassMetaMethods​(java.lang.String methodName)

  - ### getProperty

    public java.lang.Object getProperty​(java.lang.Object object, java.lang.String property)

    Retrieves a property on the given object for the specified arguments.

    Specified by:
      `getProperty` in interface `MetaObjectProtocol`
    Parameters:
      `object` - The Object which the property is being retrieved from
      `property` - The name of the property
    Returns:
      The properties value
    See Also:
      `MetaClassImpl`

  - ### setProperty

    public void setProperty​(java.lang.Object object, java.lang.String property, java.lang.Object newValue)

    Sets a property on the given object for the specified arguments.

    Specified by:
      `setProperty` in interface `MetaObjectProtocol`
    Parameters:
      `object` - The Object which the property is being retrieved from
      `property` - The name of the property
      `newValue` - The new value
    See Also:
      `MetaClassImpl`

  - ### getAttribute

    public java.lang.Object getAttribute​(java.lang.Object object, java.lang.String attribute)
    Retrieves the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.
    Specified by:
      `getAttribute` in interface `MetaObjectProtocol`
    Parameters:
      `object` - The object to get the attribute from
      `attribute` - The name of the attribute
    Returns:
      The attribute value
    See Also:
      `MetaClassImpl`

  - ### setAttribute

    public void setAttribute​(java.lang.Object object, java.lang.String attribute, java.lang.Object newValue)
    Sets the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.
    Specified by:
      `setAttribute` in interface `MetaObjectProtocol`
    Parameters:
      `object` - The object to get the attribute from
      `attribute` - The name of the attribute
      `newValue` - The new value of the attribute
    See Also:
      `MetaClassImpl`

  - ### pickMethod

    public MetaMethod pickMethod​(java.lang.String methodName, java.lang.Class[] arguments)
    Selects a method by name and argument classes. This method does not search for an exact match, it searches for a compatible method. For this the method selection mechanism is used as provided by the implementation of this MetaClass. pickMethod may or may not be used during the method selection process when invoking a method. There is no warranty for that.
    Specified by:
      `pickMethod` in interface `MetaClass`
    Parameters:
      `methodName` - the name of the method to pick
      `arguments` - the method arguments
    Returns:
      a matching MetaMethod or null
    Throws:
      `GroovyRuntimeException` - if there is more than one matching method

  - ### hasCustomInvokeMethod

    public boolean hasCustomInvokeMethod()
    indicates is the meta class method invocation for non-static methods is done through a custom invoker object.
    Returns:
      true - if the method invocation is not done by the meta class itself

  - ### hasCustomStaticInvokeMethod

    public boolean hasCustomStaticInvokeMethod()
    indicates is the meta class method invocation for static methods is done through a custom invoker object.
    Returns:
      true - if the method invocation is not done by the meta class itself

  - ### clearInvocationCaches

    protected void clearInvocationCaches()
    remove all method call cache entries. This should be done if a method is added during runtime, but not by using a category.

  - ### isPermissivePropertyAccess

    public boolean isPermissivePropertyAccess()

  - ### setPermissivePropertyAccess

    public void setPermissivePropertyAccess​(boolean permissivePropertyAccess)