K - Type of the keys contained by the MethodMappublic abstract class AbstractMethodMap<K> extends java.util.HashMap<K,MethodHandleInfo>
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMethodMap(java.lang.Object target,
java.util.Collection<java.lang.reflect.Method> methods,
MapEntryKeyFactory<K> entryKeyFactory,
java.lang.invoke.MethodHandles.Lookup lookup) |
| Modifier and Type | Method and Description |
|---|---|
MethodHandleInfo |
getMethodHandleInfo(K key)
Retrieves the methodhandleinfo mapped to the provided key.
|
abstract java.lang.Object |
invoke(K key,
ArgsFactory argsFactory)
Invokes the methodhandle contained in the methodhandleinfo mapped to the provided key with
arguments produced by the given argsfactory.
|
abstract java.lang.Object |
invoke(K key,
java.lang.Object... args)
Invokes the methodhandle contained in the methodhandleinfo mapped to the provided key with
the given arguments.
|
protected java.lang.Object |
invoke(MethodHandleInfo methodHandleInfo,
ArgsFactory argsFactory)
Invokes the methodhandle contained in the provided methodhandleinfo with the arguments
produced by the provided argsfactory.
|
protected java.lang.Object |
invoke(MethodHandleInfo methodHandleInfo,
java.lang.Object... args)
Invokes the methodhandle contained in the provided methodhandleinfo with the provided
arguments.
|
abstract java.lang.Object |
invoke(java.lang.Object... args)
Treats the first argument as the key, the remaining arguments as the methodhandle
arguments, and invokes the methodhandle contained in the methodhandleinfo
mapped to the provided key with the given arguments.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesprotected AbstractMethodMap(java.lang.Object target,
java.util.Collection<java.lang.reflect.Method> methods,
MapEntryKeyFactory<K> entryKeyFactory,
java.lang.invoke.MethodHandles.Lookup lookup)
throws DuplicateKeyException,
java.lang.IllegalAccessException,
MapEntryKeyProductionException
target - the target object to which all non-static
methodhandles will be boundmethods - the methods that will be included in the mapentryKeyFactory - the factory used to generate keys for each of the
provided methodslookup - the lookup object used to convert the provided
methods to methodhandlesDuplicateKeyException - If more than one of the same key is generated for
the entries of the methodmap.java.lang.IllegalAccessException - If MethodHandle lookup fails for any of the provided
methods.MapEntryKeyProductionException - If entry keys fail to be generated for any of the
provided methods.public MethodHandleInfo getMethodHandleInfo(K key) throws UnmappedKeyException
key - the key to which the desired methodhandleinfo is mappedUnmappedKeyException - If there is no methodhandleinfo mapped to the provided key.protected java.lang.Object invoke(MethodHandleInfo methodHandleInfo, java.lang.Object... args) throws InvocationException
methodHandleInfo - the methodhandleinfo containing the methodhandle to be invokedargs - the arguments to be passed to the methodhandleInvocationException - If invocation fails.protected java.lang.Object invoke(MethodHandleInfo methodHandleInfo, ArgsFactory argsFactory) throws ArgsProductionException, InvocationException
methodHandleInfo - the methodhandleinfo containing the methodhandle to
be invokedargsFactory - Produces the arguments that are passed to the methodhandle.ArgsProductionException - If the argsfactory fails to produce arguments.InvocationException - If invocation fails.public abstract java.lang.Object invoke(K key, java.lang.Object... args) throws UnmappedKeyException, InvocationException
key - the key to which the desired methodhandleinfo is mappedargs - the arguments to be passed to the methodhandleInvocationException - If invocation fails.UnmappedKeyException - If there is no methodhandleinfo associated with the provided
key.public abstract java.lang.Object invoke(K key, ArgsFactory argsFactory) throws UnmappedKeyException, ArgsProductionException, InvocationException
key - the key to which the desired methodhandleinfo is mappedargsFactory - Produces the arguments that are passed to the methodhandle.ArgsProductionException - If the argsfactory fails to produce arguments.InvocationException - If invocation fails.UnmappedKeyException - If there is no methodhandleinfo associated with the provided
key.public abstract java.lang.Object invoke(java.lang.Object... args)
throws UnmappedKeyException,
InvocationException
args - the key to which the desired methodhandleinfo is mapped and the
arguments to be passed to the methodhandleInvocationException - If invocation fails.UnmappedKeyException - If there is no methodhandleinfo associated with the provided
key.