Package: groovy.lang

## [Java] Class MetaClassImpl

- groovy.lang.MetaClassImpl

- All Implemented Interfaces and Traits:
    MetaClass, MutableMetaClass

      public class MetaClassImpl
      extends Object
      implements MetaClass, MutableMetaClass

  Allows methods to be dynamically added to existing classes at runtime

  See Also:
    MetaClass

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `MetaClassImpl.MetaConstructor` | This is a helper class which is used only by indy.

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static Object[]` | `EMPTY_ARGUMENTS` | Shared empty argument array used by MOP dispatch helpers.
    `protected static String` | `INVOKE_METHOD_METHOD` | Conventional Groovy instance `invokeMethod` hook name.
    `protected static String` | `METHOD_MISSING` | Conventional Groovy instance `methodMissing` hook name.
    `protected static String` | `PROPERTY_MISSING` | Conventional Groovy instance `propertyMissing` hook name.
    `protected static String` | `STATIC_METHOD_MISSING` | Synthetic method name used for static `methodMissing` dispatch.
    `protected static String` | `STATIC_PROPERTY_MISSING` | Synthetic method name used for static `propertyMissing` dispatch.
    `protected MetaMethod` | `getPropertyMethod` | Effective `getProperty` handler discovered for this meta class.
    `protected MetaMethod` | `invokeMethodMethod` | Effective `invokeMethod` handler discovered for this meta class.
    `protected boolean` | `isGroovyObject` | Indicates whether theClass implements GroovyObject.
    `protected boolean` | `isMap` | Indicates whether theClass is assignable from Map.
    `protected MetaMethodIndex` | `metaMethodIndex` | Method index used for Groovy method selection and caching.
    `protected MetaClassRegistry` | `registry` | Registry that owns this meta class.
    `protected MetaMethod` | `setPropertyMethod` | Effective `setProperty` handler discovered for this meta class.
    `protected CachedClass` | `theCachedClass` | Cached reflection view for theClass.
    `protected Class` | `theClass` | Java class represented by this meta class.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `MetaClassImpl(Class theClass, MetaMethod[] add)` Constructor
    `MetaClassImpl(Class theClass)` Constructor that sets the methods to null
    `MetaClassImpl(MetaClassRegistry registry, Class theClass, MetaMethod[] add)` Constructor with registry
    `MetaClassImpl(MetaClassRegistry registry, Class theClass)` Constructor with registry setting methods to null

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addMetaBeanProperty(MetaBeanProperty mp)` Adds a new MetaBeanProperty to this MetaClass
    `` | `public void` | `addMetaMethod(MetaMethod method)` Adds a MetaMethod to this class.
    `` | `protected void` | `addMetaMethodToIndex(MetaMethod method, Map<String, MetaMethodIndex.Cache> cacheIndex)` Adds a meta method to the supplied method index after standard-hook bookkeeping.
    `` | `public void` | `addNewInstanceMethod(Method method)` Adds an instance method to this metaclass.
    `` | `public void` | `addNewStaticMethod(Method method)` Adds a static method to this metaclass.
    `` | `protected void` | `applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors)` Turns JavaBeans property descriptors into Groovy meta properties.
    `` | `protected final void` | `checkIfGroovyObjectMethod(MetaMethod metaMethod)` Checks if the metaMethod is getProperty, setProperty, or invokeMethod.
    `` | `protected void` | `checkInitalised()` checks if the initialisation of the class id complete.
    `` | `public CachedConstructor` | `chooseConstructor(Class<?>[] argTypes)` Selects a constructor matching the given parameter types.
    `` | `protected Object` | `chooseMethod(String methodName, Object methodOrList, Class[] arguments)` Chooses the correct method to use from a list of methods which match by name.
    `` | `public Object` | `chooseNamedArgCompatibleConstructor(Class<?>[] argTypes, Object[] args)` Selects a no-arg (or outer-instance) constructor used for named-argument construction, after a direct map-style match has already failed.
    `` | `protected void` | `clearInvocationCaches()` remove all method call cache entries.
    `` | `protected static String` | `createErrorMessageForAmbiguity(String theClassName, String name, Class[] arguments, LinkedList matches)` Creates the diagnostic message for an ambiguous overload selection.
    `` | `protected MetaMethod` | `createTransformMetaMethod(MetaMethod method)` Wraps a meta method so single-list arguments are expanded before invocation.
    `` | `protected static Object` | `doChooseMostSpecificParams(String theClassName, String name, List matchingMethods, Class[] arguments, boolean checkParameterCompatibility)` Chooses the most specific overload among matching parameter type candidates.
    `` | `protected void` | `dropMethodCache(String name)` Clears cached instance method selections for the supplied method name.
    `` | `protected void` | `dropStaticMethodCache(String name)` Clears cached static method selections for the supplied method name.
    `` | `protected static MetaMethod` | `findMethodInClassHierarchy(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass)` Searches a meta-class hierarchy for the most specific visible method on the missing-method path.
    `` | `protected MetaMethod` | `findMixinMethod(String methodName, Class[] arguments)` Searches for a matching mixin method.
    `` | `protected static MetaMethod` | `findOwnMethod(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass, MetaMethod method)` Chooses the best method declared directly on the supplied meta class.
    `` | `protected MetaBeanProperty` | `findPropertyInClassHierarchy(String propertyName, CachedClass theClass)` Searches the class hierarchy for a mutable meta-class bean property on the missing-property path.
    `` | `public MetaMethod[]` | `getAdditionalMetaMethods()` Retrieves a list of additional MetaMethods held by this class
    `` | `public Object` | `getAttribute(Class sender, Object object, String attribute, boolean useSuper)` Retrieves the value of an attribute (field).
    `` | `public Object` | `getAttribute(Class sender, Object object, String attribute, boolean useSuper, boolean fromInsideClass)` Retrieves the value of an attribute (field).
    `` | `public Object` | `getAttribute(Object object, String attribute)` Retrieves the value of an attribute (field).
    `` | `public ClassInfo` | `getClassInfo()` Returns the ClassInfo for the contained Class
    `` | `public ClassNode` | `getClassNode()` Obtains a reference to the original AST for the MetaClass if it is available at runtime
    `` | `public MetaProperty` | `getEffectiveGetMetaProperty(Class sender, Object object, String name, boolean useSuper)` Returns the effective readable meta property for a property access.
    `` | `public MetaMethod` | `getMetaMethod(String name, Object[] argTypes)` See Also: MetaObjectProtocol.getMetaMethod
    `` | `public List<MetaMethod>` | `getMetaMethods()` Retrieves the list of MetaMethods held by this class.
    `` | `public MetaProperty` | `getMetaProperty(String name)` See Also: MetaObjectProtocol.getMetaProperty
    `` | `public MetaMethod` | `getMethodWithCaching(Class sender, String methodName, Object[] arguments, boolean isCallToSuper)` Resolves a method and caches the selection for the supplied argument types.
    `` | `public MetaMethod` | `getMethodWithCaching(Class sender, String methodName, Class<?>[] params)` Selects a method using pre-converted parameter types and the call-site style method cache (keyed by `Class[]`).
    `` | `public MetaMethod` | `getMethodWithoutCaching(Class sender, String methodName, Class[] arguments, boolean isCallToSuper)` Resolves a method without populating the method cache.
    `` | `public List<MetaMethod>` | `getMethods()` Retrieves the list of MetaMethods held by the class.
    `` | `protected static Class<?>` | `getNonClosureOuter(Class<?> c)` Since: 6.0.0
    `` | `public List<MetaProperty>` | `getProperties()` Returns the available properties for this type.
    `` | `public Object` | `getProperty(Class sender, Object object, String name, 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 isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly * to the super class if necessary * * Parameters: `sender` - The java.lang.Class instance that requested the property * `receiver` - The Object which the property is being retrieved from * `property` - The name of the property * `isCallToSuper` - Whether the call is to a super class property * `fromInsideClass` - ?? * * Returns: The property's value.
    `` | `public Object` | `getProperty(Object object, String property)`
    `` | `public MetaClassRegistry` | `getRegistry()` Returns the registry for this metaclass
    `` | `public MetaMethod` | `getStaticMetaMethod(String name, Object[] argTypes)` See Also: MetaObjectProtocol.getStaticMetaMethod
    `` | `protected Object` | `getSubclassMetaMethods(String methodName)` Returns subclass-scoped meta methods contributed by specialized meta classes.
    `` | `protected LinkedList<CachedClass>` | `getSuperClasses()` Returns the cached super-class chain used while building method and property indexes.
    `` | `public final CachedClass` | `getTheCachedClass()` Returns the cached class for this metaclass
    `` | `public Class` | `getTheClass()` Returns the class this metaclass represents.
    `` | `public int` | `getVersion()` Returns version of the contained Class
    `` | `protected static long` | `handleMatches(long matchesDistance, LinkedList matches, Object method, long dist)` Updates the current best-match set using the supplied distance metric.
    `` | `public boolean` | `hasCustomInvokeMethod()` indicates is the metaclass method invocation for non-static methods is done through a custom invoker object.
    `` | `public boolean` | `hasCustomStaticInvokeMethod()` indicates is the metaclass method invocation for static methods is done through a custom invoker object.
    `` | `public MetaProperty` | `hasProperty(Object obj, String name)` See Also: MetaObjectProtocol.hasProperty
    `` | `public void` | `incVersion()` Increments version of the contained Class
    `` | `public void` | `initialize()` Complete the initialisation process.
    `` | `public Object` | `invokeConstructor(Object[] arguments)` * 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 * * Parameters: `arguments` - The arguments to the constructor * Returns: An instance of the java.lang.Class that this MetaObjectProtocol object applies to
    `` | `public Object` | `invokeMethod(Object object, String methodName, Object arguments)` Invoke a method on the given object with the given arguments.
    `` | `public Object` | `invokeMethod(Object object, String methodName, Object[] arguments)` Invokes a method on the given receiver for the specified arguments.
    `` | `public Object` | `invokeMethod(Class sender, Object object, String methodName, Object[] originalArguments, boolean isCallToSuper, boolean fromInsideClass)` Invokes a method on the given receiver for the specified arguments.
    `` | `public Object` | `invokeMissingMethod(Object instance, String methodName, Object[] arguments)` Invoke a missing method on the given object with the given arguments.
    `` | `public Object` | `invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)` Invoke a missing property on the given object with the given arguments.
    `` | `public Object` | `invokeStaticMethod(Object object, String methodName, Object[] arguments)` * 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 * * See Also: * 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
    `` | `protected Object` | `invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)` Hook to deal with the case of missing property for static properties.
    `` | `public boolean` | `isGroovyObject()` Indicates if the represented class is an instance of the GroovyObject class.
    `` | `protected boolean` | `isInitialized()` Indicates whether this meta class finished initialization.
    `` | `public boolean` | `isModified()` Returns whether this MetaClassImpl has been modified.
    `` | `public boolean` | `isPermissivePropertyAccess()` Indicates whether permissive property access semantics are enabled.
    `` | `protected void` | `onGetPropertyFoundInHierarchy(MetaMethod method)` Callback invoked when a `getProperty` implementation is discovered.
    `` | `protected void` | `onInvokeMethodFoundInHierarchy(MetaMethod method)` Callback invoked when an `invokeMethod` implementation is discovered.
    `` | `protected void` | `onMixinMethodFound(MetaMethod method)` Callback invoked when a mixin method is discovered during initialization.
    `` | `protected void` | `onSetPropertyFoundInHierarchy(MetaMethod method)` Callback invoked when a `setProperty` implementation is discovered.
    `` | `protected void` | `onSuperMethodFoundInHierarchy(MetaMethod method)` Callback invoked when a super-class method is discovered during initialization.
    `` | `protected void` | `onSuperPropertyFoundInHierarchy(MetaBeanProperty property)` Callback invoked when a super-class bean property is discovered during initialization.
    `` | `public MetaMethod` | `pickMethod(String methodName, Class[] arguments)` Selects a method by name and argument classes.
    `` | `protected void` | `reinitialize()` Rebuilds method, property and call-site state for this meta class.
    `` | `public List<MetaMethod>` | `respondsTo(Object obj, String name, Object[] argTypes)` See Also: MetaObjectProtocol.respondsTo
    `` | `public List<MetaMethod>` | `respondsTo(Object obj, String name)` See Also: MetaObjectProtocol.respondsTo
    `` | `public Constructor` | `retrieveConstructor(Class[] arguments)` Resolves a constructor by parameter types.
    `` | `public MetaMethod` | `retrieveStaticMethod(String methodName, Object[] arguments)` Resolves a static method and caches the selection when possible.
    `` | `public int` | `selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)` * * Internal method to support Groovy runtime. Not for client usage. * * Parameters: `numberOfConstructors` - The number of constructors * `arguments` - The arguments * * Returns: selected index
    `` | `public void` | `setAttribute(Class sender, Object object, String attribute, Object newValue, boolean useSuper, boolean fromInsideClass)`
    `` | `public void` | `setAttribute(Object object, String attribute, Object newValue)` Sets the value of an attribute (field).
    `` | `protected void` | `setInitialized(boolean initialized)` Updates the initialization flag for this meta class.
    `` | `public void` | `setPermissivePropertyAccess(boolean permissivePropertyAccess)` Enables or disables permissive property access semantics.
    `` | `public void` | `setProperties(Object bean, 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
    `` | `public void` | `setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)` Writes a property on the given receiver for the specified arguments.
    `` | `public void` | `setProperty(Object object, String property, Object newValue)`
    `` | `public String` | `toString()` Returns a string representation of this metaclass

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final Object[] EMPTY_ARGUMENTS

      Shared empty argument array used by MOP dispatch helpers.

    - #### protected static final String INVOKE_METHOD_METHOD

      Conventional Groovy instance `invokeMethod` hook name.

    - #### protected static final String METHOD_MISSING

      Conventional Groovy instance `methodMissing` hook name.

    - #### protected static final String PROPERTY_MISSING

      Conventional Groovy instance `propertyMissing` hook name.

    - #### protected static final String STATIC_METHOD_MISSING

      Synthetic method name used for static `methodMissing` dispatch.

    - #### protected static final String STATIC_PROPERTY_MISSING

      Synthetic method name used for static `propertyMissing` dispatch.

    - #### protected MetaMethod getPropertyMethod

      Effective `getProperty` handler discovered for this meta class.

    - #### protected MetaMethod invokeMethodMethod

      Effective `invokeMethod` handler discovered for this meta class.

    - #### protected final boolean isGroovyObject

      Indicates whether theClass implements GroovyObject.

    - #### protected final boolean isMap

      Indicates whether theClass is assignable from Map.

    - #### protected final MetaMethodIndex metaMethodIndex

      Method index used for Groovy method selection and caching.

    - #### protected MetaClassRegistry registry

      Registry that owns this meta class.

    - #### protected MetaMethod setPropertyMethod

      Effective `setProperty` handler discovered for this meta class.

    - #### protected final CachedClass theCachedClass

      Cached reflection view for theClass.

    - #### protected final Class theClass

      Java class represented by this meta class.

  - ### Constructor Detail

    - #### public MetaClassImpl(Class theClass, MetaMethod[] add)

      Constructor

      Parameters:
        `theClass` - The class this is the metaclass for
        `add` - The methods for this class

    - #### public MetaClassImpl(Class theClass)

      Constructor that sets the methods to null

      Parameters:
        `theClass` - The class this is the metaclass for

    - #### public MetaClassImpl(MetaClassRegistry registry, Class theClass, MetaMethod[] add)

      Constructor with registry

      Parameters:
        `registry` - The metaclass registry for this MetaClass
        `theClass` - The class
        `add` - The methods

    - #### public MetaClassImpl(MetaClassRegistry registry, Class theClass)

      Constructor with registry setting methods to null

      Parameters:
        `registry` - The metaclass registry for this MetaClass
        `theClass` - The class

  - ### Method Detail

    - #### public void addMetaBeanProperty(MetaBeanProperty mp)

      Adds a new MetaBeanProperty to this MetaClass

      Parameters:
        `mp` - The MetaBeanProperty

    - #### public void addMetaMethod(MetaMethod method)

      Adds a MetaMethod to this class. WARNING: this method will not do the necessary 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.

      See Also:
        initialize()

    - #### protected void addMetaMethodToIndex(MetaMethod method, Map<String, MetaMethodIndex.Cache> cacheIndex)

      Adds a meta method to the supplied method index after standard-hook bookkeeping.

      Parameters:
        `method` - the method to index
        `cacheIndex` - the target index bucket

    - #### public void addNewInstanceMethod(Method method)

      Adds an instance method to this metaclass.

      Parameters:
        `method` - The method to be added

    - #### public void addNewStaticMethod(Method method)

      Adds a static method to this metaclass.

      Parameters:
        `method` - The method to be added

    - #### protected void applyPropertyDescriptors(PropertyDescriptor[] propertyDescriptors)

      Turns JavaBeans property descriptors into Groovy meta properties.

      Parameters:
        `propertyDescriptors` - the descriptors to apply

    - #### protected final void checkIfGroovyObjectMethod(MetaMethod metaMethod)

      Checks if the metaMethod is getProperty, setProperty, or invokeMethod.

      See Also:
        GroovyObject

    - #### 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:
        IllegalStateException if the initialisation is incomplete yet

    - #### public CachedConstructor chooseConstructor(Class<?>[] argTypes)

      Selects a constructor matching the given parameter types.

      Parameters:
        `argTypes` - the constructor argument types
      Returns:
        the matching cached constructor, or `null`
      Since:
        6.0.0

    - #### protected Object chooseMethod(String methodName, Object methodOrList, 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

    - #### public Object chooseNamedArgCompatibleConstructor(Class<?>[] argTypes, Object[] args)

      Selects a no-arg (or outer-instance) constructor used for named-argument construction, after a direct map-style match has already failed.

      Parameters:
        `argTypes` - the original argument types including the trailing map
        `args` - the original arguments including the trailing map
      Returns:
        the matching constructor as a CachedConstructor, or another ParameterTypes result from method selection
      Since:
        6.0.0

    - #### 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.

    - #### protected static String createErrorMessageForAmbiguity(String theClassName, String name, Class[] arguments, LinkedList matches)

      Creates the diagnostic message for an ambiguous overload selection.

      Parameters:
        `theClassName` - the receiver class name
        `name` - the method name
        `arguments` - the runtime argument types
        `matches` - the ambiguous candidates
      Returns:
        the ambiguity message

    - #### protected MetaMethod createTransformMetaMethod(MetaMethod method)

      Wraps a meta method so single-list arguments are expanded before invocation.

      Parameters:
        `method` - the method to wrap
      Returns:
        the transforming method, or `null` if the input method is `null`

    - #### protected static Object doChooseMostSpecificParams(String theClassName, String name, List matchingMethods, Class[] arguments, boolean checkParameterCompatibility)

      Chooses the most specific overload among matching parameter type candidates.

      Parameters:
        `theClassName` - the receiver class name used in diagnostics
        `name` - the method name
        `matchingMethods` - the candidate methods
        `arguments` - the runtime argument types
        `checkParameterCompatibility` - whether candidates should be filtered for compatibility first
      Returns:
        the selected candidate, or `null` if none matches

    - #### protected void dropMethodCache(String name)

      Clears cached instance method selections for the supplied method name.

      Parameters:
        `name` - the method name whose cache entries should be cleared

    - #### protected void dropStaticMethodCache(String name)

      Clears cached static method selections for the supplied method name.

      Parameters:
        `name` - the method name whose cache entries should be cleared

    - #### protected static MetaMethod findMethodInClassHierarchy(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass)

      Searches a meta-class hierarchy for the most specific visible method on the missing-method path.

      For a starting MetaClassImpl, the walk opens only when some strong MetaClass in the receiver hierarchy is a modified MutableMetaClass (typically ExpandoMetaClass). This is how patterns such as `Object.metaClass.foo = …` / parent EMC methods become visible on subclass receivers without giving every subtype its own EMC.

      6.0 (GROOVY-12191): this walk is retained. Linked miss sites re-enter it live without SwitchPoint fan-out — see IndyInvalidation.

      Parameters:
        `instanceKlazz` - the runtime receiver class
        `methodName` - the method name
        `arguments` - the parameter types
        `metaClass` - the starting meta class
      Returns:
        the selected method, or `null` if none matches

    - #### protected MetaMethod findMixinMethod(String methodName, Class[] arguments)

      Searches for a matching mixin method.

      Parameters:
        `methodName` - the method name
        `arguments` - the parameter types
      Returns:
        the matching mixin method, or `null` if none is found

    - #### protected static MetaMethod findOwnMethod(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass, MetaMethod method)

      Chooses the best method declared directly on the supplied meta class.

      Parameters:
        `instanceKlazz` - the runtime receiver class
        `methodName` - the method name
        `arguments` - the parameter types
        `metaClass` - the meta class being inspected
        `method` - the current best method candidate
      Returns:
        the updated best method candidate

    - #### protected MetaBeanProperty findPropertyInClassHierarchy(String propertyName, CachedClass theClass)

      Searches the class hierarchy for a mutable meta-class bean property on the missing-property path. Linked miss sites re-enter this walk live (no SwitchPoint fan-out); see IndyInvalidation.

      Parameters:
        `propertyName` - the property name
        `theClass` - the class to start searching from
      Returns:
        the matching bean property, or `null` if none is found

    - #### public MetaMethod[] getAdditionalMetaMethods()

      Retrieves a list of additional MetaMethods held by this class

      Returns:
        A list of MetaMethods

    - #### public Object getAttribute(Class sender, Object object, 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.

      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

    - #### public Object getAttribute(Class sender, Object object, 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

    - #### public Object getAttribute(Object object, String attribute)

      Retrieves the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.

      Parameters:
        `object` - The object to get the attribute from
        `attribute` - The name of the attribute
      Returns:
        The attribute value

    - #### public ClassInfo getClassInfo()

      Returns the ClassInfo for the contained Class

      Returns:
        The ClassInfo for the contained class.

    - #### public ClassNode getClassNode()

      Obtains a reference to the original AST for the MetaClass if it is available at runtime

      Returns:
        The original AST or null if it cannot be returned

    - #### public MetaProperty getEffectiveGetMetaProperty(Class sender, Object object, String name, boolean useSuper)

      Returns the effective readable meta property for a property access.

      Parameters:
        `sender` - the calling class
        `object` - the receiver object or class
        `name` - the property name
        `useSuper` - whether the lookup should start at the super class
      Returns:
        the effective readable meta property

    - #### public MetaMethod getMetaMethod(String name, Object[] argTypes)

      See Also:
        MetaObjectProtocol.getMetaMethod

    - #### public List<MetaMethod> getMetaMethods()

      Retrieves the list of MetaMethods held by this class. This list includes MetaMethods added by groovy.lang.ExpandoMetaClass.

      Returns:
        A list of MetaMethods

    - #### public MetaProperty getMetaProperty(String name)

      See Also:
        MetaObjectProtocol.getMetaProperty

    - #### public MetaMethod getMethodWithCaching(Class sender, String methodName, Object[] arguments, boolean isCallToSuper)

      Resolves a method and caches the selection for the supplied argument types.

      Parameters:
        `sender` - the calling class
        `methodName` - the method name
        `arguments` - the runtime arguments
        `isCallToSuper` - whether the dispatch originated from `super`
      Returns:
        the selected meta method, or `null` if none matches

    - #### public MetaMethod getMethodWithCaching(Class sender, String methodName, Class<?>[] params)

      Selects a method using pre-converted parameter types and the call-site style method cache (keyed by `Class[]`).

      Prefer getMethodWithCaching(Class, String, Object[], boolean) when only runtime argument values are available. This overload exists so optional runtime modules (e.g. classic call-site dispatch) can share the same selection path without depending on package-private state.

      Parameters:
        `sender` - the class whose meta-method index is consulted
        `methodName` - the method name
        `params` - the argument types (must not be `null`)
      Returns:
        the selected meta method, or `null` if none matches
      Since:
        6.0.0

    - #### public MetaMethod getMethodWithoutCaching(Class sender, String methodName, Class[] arguments, boolean isCallToSuper)

      Resolves a method without populating the method cache.

      Parameters:
        `sender` - the calling class
        `methodName` - the method name
        `arguments` - the parameter types
        `isCallToSuper` - whether the dispatch originated from `super`
      Returns:
        the selected meta method, or `null` if none matches

    - #### public List<MetaMethod> getMethods()

      Retrieves the list of MetaMethods held by the class. This list does not include MetaMethods added by groovy.lang.ExpandoMetaClass.

      Returns:
        A list of MetaMethods

    - #### protected static Class<?> getNonClosureOuter(Class<?> c)

      Since:
        6.0.0

    - #### public List<MetaProperty> getProperties()

      Returns the available properties for this type.

      Returns:
        a list of `MetaProperty` objects

    - #### public Object getProperty(Class sender, Object object, String name, 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 isCallToSuper and fromInsideClass help the Groovy runtime perform optimisations on the call to go directly * to the super class if necessary * *

      Parameters:
        `sender` - The java.lang.Class instance that requested the property *
        `receiver` - The Object which the property is being retrieved from *
        `property` - The name of the property *
        `isCallToSuper` - Whether the call is to a super class property *
        `fromInsideClass` - ?? * *
      Returns:
        The property's value.

    - #### public Object getProperty(Object object, String property)

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

      Parameters:
        `object` - The Object which the property is being retrieved from
        `property` - The name of the property
      Returns:
        The properties value

    - #### public MetaClassRegistry getRegistry()

      Returns the registry for this metaclass

      Returns:
        The registry

    - #### public MetaMethod getStaticMetaMethod(String name, Object[] argTypes)

      See Also:
        MetaObjectProtocol.getStaticMetaMethod

    - #### protected Object getSubclassMetaMethods(String methodName)

      Returns subclass-scoped meta methods contributed by specialized meta classes.

      Parameters:
        `methodName` - the method name
      Returns:
        subclass methods for the name, or `null` if none are registered

    - #### protected LinkedList<CachedClass> getSuperClasses()

      Returns the cached super-class chain used while building method and property indexes.

      Returns:
        the cached super classes in lookup order

    - #### public final CachedClass getTheCachedClass()

      Returns the cached class for this metaclass

      Returns:
        The cached class.

    - #### public Class getTheClass()

      Returns the class this metaclass represents.

    - #### public int getVersion()

      Returns version of the contained Class

      Returns:
        The version of the contained class.

    - #### protected static long handleMatches(long matchesDistance, LinkedList matches, Object method, long dist)

      Updates the current best-match set using the supplied distance metric.

      Parameters:
        `matchesDistance` - the best distance seen so far
        `matches` - the current best candidates
        `method` - the candidate method
        `dist` - the candidate distance
      Returns:
        the updated best distance

    - #### public boolean hasCustomInvokeMethod()

      indicates is the metaclass method invocation for non-static methods is done through a custom invoker object.

      Returns:
        true - if the method invocation is not done by the metaclass itself

    - #### public boolean hasCustomStaticInvokeMethod()

      indicates is the metaclass method invocation for static methods is done through a custom invoker object.

      Returns:
        true - if the method invocation is not done by the metaclass itself

    - #### public MetaProperty hasProperty(Object obj, String name)

      See Also:
        MetaObjectProtocol.hasProperty

    - #### public void incVersion()

      Increments version of the contained Class

    - #### public void initialize()

      Complete the initialisation process. After this method is called no methods should be added to the metaclass. 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.

    - #### public Object invokeConstructor(Object[] arguments)

      * 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 * *

      Parameters:
        `arguments` - The arguments to the constructor *
      Returns:
        An instance of the java.lang.Class that this MetaObjectProtocol object applies to

    - #### public Object invokeMethod(Object object, String methodName, Object arguments)

      Invoke a method on the given object with the given arguments.

      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.

    - #### public Object invokeMethod(Object object, String methodName, Object[] arguments)

      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.

      Parameters:
        `object` - The object which the method was invoked on
        `methodName` - The name of the method
        `arguments` - The arguments to the method
      Returns:
        The return value of the method
      See Also:
        MetaClass.invokeMethod

    - #### public Object invokeMethod(Class sender, Object object, String methodName, 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

      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

    - #### public Object invokeMissingMethod(Object instance, String methodName, Object[] arguments)

      Invoke a missing method on the given object with the given arguments.

      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.

    - #### public Object invokeMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)

      Invoke a missing property on the given object with the given arguments.

      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.

    - #### public Object invokeStaticMethod(Object object, String methodName, Object[] arguments)

      * 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 * *

      See Also:
        *
      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

    - #### protected Object invokeStaticMissingProperty(Object instance, String propertyName, Object optionalValue, boolean isGetter)

      Hook to deal with the case of missing property for static properties. The method attempts to look up "$static_propertyMissing" handlers and invoke them otherwise throws a MissingPropertyException.

      throws:
        MissingPropertyException
      Parameters:
        `instance` - the class instance
        `propertyName` - the name of the property
        `optionalValue` - the value in the case of a setter
        `isGetter` - true for property read, false for property write
      Returns:
        The value in the case of a getter or null in the case of a setter.

    - #### public boolean isGroovyObject()

      Indicates if the represented class is an instance of the GroovyObject class.

    - #### protected boolean isInitialized()

      Indicates whether this meta class finished initialization.

      Returns:
        `true` once initialization completed

    - #### public boolean isModified()

      Returns whether this MetaClassImpl has been modified. Since MetaClassImpl is not designed for modification this method always returns false

      Returns:
        false

    - #### public boolean isPermissivePropertyAccess()

      Indicates whether permissive property access semantics are enabled.

      Returns:
        `true` if missing getters may still resolve fields or map entries

    - #### protected void onGetPropertyFoundInHierarchy(MetaMethod method)

      Callback invoked when a `getProperty` implementation is discovered.

      Parameters:
        `method` - the discovered handler

    - #### protected void onInvokeMethodFoundInHierarchy(MetaMethod method)

      Callback invoked when an `invokeMethod` implementation is discovered.

      Parameters:
        `method` - the discovered handler

    - #### protected void onMixinMethodFound(MetaMethod method)

      Callback invoked when a mixin method is discovered during initialization.

      Parameters:
        `method` - the discovered mixin method

    - #### protected void onSetPropertyFoundInHierarchy(MetaMethod method)

      Callback invoked when a `setProperty` implementation is discovered.

      Parameters:
        `method` - the discovered handler

    - #### protected void onSuperMethodFoundInHierarchy(MetaMethod method)

      Callback invoked when a super-class method is discovered during initialization.

      Parameters:
        `method` - the inherited method

    - #### protected void onSuperPropertyFoundInHierarchy(MetaBeanProperty property)

      Callback invoked when a super-class bean property is discovered during initialization.

      Parameters:
        `property` - the inherited property

    - #### public MetaMethod pickMethod(String methodName, 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.

      throws:
        GroovyRuntimeException if there is more than one matching method
      Parameters:
        `methodName` - the name of the method to pick
        `arguments` - the method arguments
      Returns:
        a matching MetaMethod or null

    - #### protected void reinitialize()

      Rebuilds method, property and call-site state for this meta class.

    - #### public List<MetaMethod> respondsTo(Object obj, String name, Object[] argTypes)

      See Also:
        MetaObjectProtocol.respondsTo

    - #### public List<MetaMethod> respondsTo(Object obj, String name)

      See Also:
        MetaObjectProtocol.respondsTo

    - #### public Constructor retrieveConstructor(Class[] arguments)

      Resolves a constructor by parameter types.

      Parameters:
        `arguments` - the constructor parameter types
      Returns:
        the matching constructor, or `null` if none matches

    - #### public MetaMethod retrieveStaticMethod(String methodName, Object[] arguments)

      Resolves a static method and caches the selection when possible.

      Parameters:
        `methodName` - the method name
        `arguments` - the runtime arguments
      Returns:
        the selected static meta method, or `null` if none matches

    - #### public int selectConstructorAndTransformArguments(int numberOfConstructors, Object[] arguments)

      * * Internal method to support Groovy runtime. Not for client usage. * *

      Parameters:
        `numberOfConstructors` - The number of constructors *
        `arguments` - The arguments * *
      Returns:
        selected index

    - #### public void setAttribute(Class sender, Object object, String attribute, 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

      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

    - #### public void setAttribute(Object object, String attribute, Object newValue)

      Sets the value of an attribute (field). This method is to support the Groovy runtime and not for general client API usage.

      Parameters:
        `object` - The object to get the attribute from
        `attribute` - The name of the attribute
        `newValue` - The new value of the attribute

    - #### protected void setInitialized(boolean initialized)

      Updates the initialization flag for this meta class.

      Parameters:
        `initialized` - the new initialization state

    - #### public void setPermissivePropertyAccess(boolean permissivePropertyAccess)

      Enables or disables permissive property access semantics.

      Parameters:
        `permissivePropertyAccess` - the new permissive-property-access flag

    - #### public void setProperties(Object bean, 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

    - #### public void setProperty(Class sender, Object object, String name, Object newValue, boolean useSuper, boolean fromInsideClass)

      Writes 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 runtime perform optimisations on the call to go directly to the super class if necessary

      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.

    - #### public void setProperty(Object object, String property, Object newValue)

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

      Parameters:
        `object` - The Object which the property is being retrieved from
        `property` - The name of the property
        `newValue` - The new value

    - #### public String toString()

      Returns a string representation of this metaclass