V
- the type of the values in the mappublic class MethodIdMap<V> extends Object
MethodIdHolder
s. This data structure can be used for mapping
identifiers to methods without requiring eager resolution of the latter (e.g., to
ResolvedJavaMethod
s) and has retrieval as fast as array indexing. The constraints on
using such a map are:
Modifier and Type | Class and Description |
---|---|
static class |
MethodIdMap.MethodKey<T>
Key for a method.
|
Modifier and Type | Field and Description |
---|---|
private V[] |
entries
Entry array that is initialized upon first call to
get(MethodIdHolder) . |
private static int |
INITIAL_CAPACITY |
private MetaAccessProvider |
metaAccess |
private int |
minId
The minimum id for a key in this map.
|
private List<MethodIdMap.MethodKey<V>> |
registrations
Initial list of entries.
|
Constructor and Description |
---|
MethodIdMap(MetaAccessProvider metaAccess) |
Modifier and Type | Method and Description |
---|---|
protected V[] |
allocateEntries(int length) |
boolean |
containsKey(MethodIdMap.MethodKey<V> key)
Determines if a method denoted by a given
MethodIdMap.MethodKey is in this map. |
void |
createEntries() |
V |
get(MethodIdHolder method) |
MetaAccessProvider |
getMetaAccess() |
MethodIdMap.MethodKey<V> |
put(V value,
boolean isStatic,
boolean isOptional,
Class<?> declaringClass,
String name,
Class<?>... argumentTypes)
Adds an entry to this map for a specified method.
|
int |
size() |
String |
toString() |
private final MetaAccessProvider metaAccess
private final List<MethodIdMap.MethodKey<V>> registrations
private volatile V[] entries
get(MethodIdHolder)
.
Note: this must be volatile since double-checked locking is used to initialize itprivate static final int INITIAL_CAPACITY
public MethodIdMap(MetaAccessProvider metaAccess)
public MethodIdMap.MethodKey<V> put(V value, boolean isStatic, boolean isOptional, Class<?> declaringClass, String name, Class<?>... argumentTypes)
value
- value to be associated with the specified methodisStatic
- specifies if the method is staticisOptional
- specifies if the method is optionaldeclaringClass
- the class declaring the methodname
- the name of the methodargumentTypes
- the argument types of the method. Element 0 of this array must be
declaringClass
iff the method is non-static.protected V[] allocateEntries(int length)
public boolean containsKey(MethodIdMap.MethodKey<V> key)
MethodIdMap.MethodKey
is in this map.public V get(MethodIdHolder method)
public void createEntries()
public MetaAccessProvider getMetaAccess()
public int size()