public class MetaMethodIndex
extends Object
An index of metamethods for a class, organized by method name and signature. Provides efficient lookup of methods for static, normal, and super method calls. Uses caching to optimize method lookup performance.
This class is for internal use by the Groovy runtime's metaclass system.
| Modifiers | Name | Description |
|---|---|---|
static class |
MetaMethodIndex.Cache |
A cache of metamethods indexed by name. |
static class |
MetaMethodIndex.MetaMethodCache |
A cache entry for a metamethod with its parameter types. |
| Constructor and description |
|---|
MetaMethodIndex(CachedClass theCachedClass)Constructs a new MetaMethodIndex for the given class. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addMetaMethod(MetaMethod method, Map<String, Cache> map)Adds a metamethod to the index. |
|
public Object |
addMethodToList(Object o, MetaMethod toIndex)Adds a metamethod to a method list, handling overrides and duplicates. |
|
public void |
clearCaches()Clears all cached metamethods across all cache entries. |
|
public void |
clearCaches(String name)Clears all cached metamethods for methods with the given name. |
|
public void |
copyMethodsToSuper()Copies all methods to their super method counterparts in the cache index. |
|
public void |
copyNonPrivateMethods(Map<String, Cache> from, Map<String, Cache> to)Copies all non-private methods from one method cache map to another. |
|
public void |
copyNonPrivateNonNewMetaMethods(Map<String, Cache> from, Map<String, Cache> to)Copies all non-private, non-new metamethods from one method cache map to another. |
|
public Map<String, Cache> |
getHeader(Class<?> cls)Gets the method cache header for the given class. |
|
public final MetaMethodIndex.Cache |
getMethods(Class<?> cls, String name)Gets the cached methods for a given class and method name. |
a map of the starter class plus its super classes to save method lists for static/normal/super method calls. It also provides a simple cache of one method name and call signature to method per static/normal/super call.
The main class for which this index was created
Constructs a new MetaMethodIndex for the given class.
theCachedClass - the cached class for which to build the indexAdds a metamethod to the index.
method - the metamethod to addmap - the cache map to add the method toAdds a metamethod to a method list, handling overrides and duplicates. Returns either a single MetaMethod, a FastArray of methods, or the original object.
o - the existing method list (can be null, a MetaMethod, or a FastArray)toIndex - the metamethod to addClears all cached metamethods across all cache entries.
Clears all cached metamethods for methods with the given name.
name - the method nameCopies all methods to their super method counterparts in the cache index.
Copies all non-private methods from one method cache map to another.
from - the source method cache mapto - the destination method cache mapCopies all non-private, non-new metamethods from one method cache map to another.
from - the source method cache mapto - the destination method cache mapGets the method cache header for the given class.
cls - the classGets the cached methods for a given class and method name.
cls - the class to look upname - the method nameCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.