Uses of Class
java.lang.invoke.MethodHandle
-
Packages that use MethodHandle Package Description java.lang.invoke Thejava.lang.invoke
package provides low-level primitives for interacting with the Java Virtual Machine.jdk.dynalink Contains interfaces and classes that are used to link aninvokedynamic
call site.jdk.dynalink.beans Contains the linker for ordinary Java objects.jdk.dynalink.linker Contains interfaces and classes needed by language runtimes to implement their own language-specific object models and type conversions.jdk.dynalink.linker.support Contains classes that make it more convenient for language runtimes to implement their own language-specific object models and type conversions by providing basic implementations of some classes as well as various utilities. -
-
Uses of MethodHandle in java.lang.invoke
Methods in java.lang.invoke that return MethodHandle Modifier and Type Method Description static MethodHandle
MethodHandles. arrayConstructor(Class<?> arrayType)
Return a MethodHandle that produces an array of the requested type with the passed-in length.static MethodHandle
MethodHandles. arrayElementGetter(Class<?> arrayType)
Return a MethodHandle able to read from the array.static MethodHandle
MethodHandles. arrayElementSetter(Class<?> arrayType)
Return a MethodHandle able to write to the array.static MethodHandle
MethodHandles. arrayLength(Class<?> arrayType)
Return a MethodHandle that fetches the length from the passed-in array.MethodHandle
MethodHandle. asCollector(int collectPosition, Class<?> arrayClass, int collectCount)
Returns a MethodHandle that collects the requested incoming arguments, which must match the types in MethodType incomingArgs, into an array of arrayClass, called T.MethodHandle
MethodHandle. asCollector(Class<?> arrayClass, int collectCount)
Returns a MethodHandle that collects the requested incoming arguments, which must match the types in MethodType incomingArgs, into an array of arrayClass, called T.MethodHandle
MethodHandle. asFixedArity()
Return a fixed arity version of the current MethodHandle.MethodHandle
MethodHandle. asSpreader(int spreadPosition, Class<?> arrayClass, int spreadCount)
Produce a MethodHandle that has an array of type arrayClass as its argument at the specified position and replaces the array with spreadCount arguments from the array before calling the original MethodHandle.MethodHandle
MethodHandle. asSpreader(Class<?> arrayClass, int spreadCount)
Produce a MethodHandle that has an array of type arrayClass as its last argument and replaces the array with spreadCount arguments from the array before calling the original MethodHandle.MethodHandle
MethodHandle. asType(MethodType newType)
Returns a MethodHandle that presents as being of MethodType newType.MethodHandle
MethodHandle. asVarargsCollector(Class<?> arrayParameter)
Create an varargs collector adapter on this MethodHandle.MethodHandle
MethodHandles.Lookup. bind(Object receiver, String methodName, MethodType type)
Return an early-bound method handle to a non-static method.MethodHandle
MethodHandle. bindTo(Object value)
Bind the value as the first argument to the MethodHandlestatic MethodHandle
MethodHandles. catchException(MethodHandle tryHandle, Class<? extends Throwable> throwableClass, MethodHandle catchHandle)
Produce a MethodHandle that implements a try-catch block.static MethodHandle
MethodHandles. collectArguments(MethodHandle target, int pos, MethodHandle filter)
Produce a MethodHandle that preprocesses some of the arguments by calling the filter handle.static MethodHandle
MethodHandles. constant(Class<?> returnType, Object constantValue)
Create a MethodHandle that returns the constantValue on each invocation.static MethodHandle
MethodHandles. countedLoop(MethodHandle loopCountHandle, MethodHandle initHandle, MethodHandle bodyHandle)
Produce a loop handle that executes a given number of iterations.static MethodHandle
MethodHandles. countedLoop(MethodHandle startHandle, MethodHandle endHandle, MethodHandle initHandle, MethodHandle bodyHandle)
Produce a loop handle that iterates over a range of numbers by specifying the start value and the end value of the loop counter.static MethodHandle
MethodHandles. doWhileLoop(MethodHandle initHandle, MethodHandle bodyHandle, MethodHandle predHandle)
Produce a loop handle that wraps an initializer, a loop body and a predicate to execute a do-while loop.static MethodHandle
MethodHandles. dropArguments(MethodHandle originalHandle, int location, Class<?>... valueTypes)
This method returns a method handle that delegates to the original method handle, ignoring a particular range of arguments (starting at a given location and with given types).static MethodHandle
MethodHandles. dropArguments(MethodHandle originalHandle, int location, List<Class<?>> valueTypes)
This method returns a method handle that delegates to the original method handle, ignoring a particular range of arguments (starting at a given location and with given types).static MethodHandle
MethodHandles. dropArgumentsToMatch(MethodHandle originalHandle, int skippedArgumentCount, List<Class<?>> valueTypes, int location)
This method returns a method handle that delegates to the original method handle, skipping over a specified number of arguments at the given location.abstract MethodHandle
CallSite. dynamicInvoker()
Return a MethodHandle equivalent to the invokedynamic instruction on this CallSite.MethodHandle
ConstantCallSite. dynamicInvoker()
Return the target MethodHandle of this CallSite.static MethodHandle
MethodHandles. empty(MethodType targetMethodType)
Produces a constant method handle that ignores arguments and returns the default value for the return type of the requested MethodType.static MethodHandle
MethodHandles. exactInvoker(MethodType type)
Return a MethodHandle that is the equivalent of calling MethodHandles.lookup().findVirtual(MethodHandle.class, "invokeExact", type).static MethodHandle
MethodHandles. explicitCastArguments(MethodHandle handle, MethodType type)
Produce an adapter that converts the incoming arguments from type to the underlying MethodHandle's type and converts the return value as required.static MethodHandle
MethodHandles. filterArguments(MethodHandle handle, int startPosition, MethodHandle... filters)
Produce a MethodHandle that adapts its arguments using the filter methodhandles before calling the underlying handle.static MethodHandle
MethodHandles. filterReturnValue(MethodHandle handle, MethodHandle filter)
Return a MethodHandle that will adapt the return value of handle by running the filter on it and returning the result of the filter.MethodHandle
MethodHandles.Lookup. findConstructor(Class<?> declaringClass, MethodType type)
Return a MethodHandle that will create an object of the required class and initialize it using the constructor method with signature type.MethodHandle
MethodHandles.Lookup. findGetter(Class<?> clazz, String fieldName, Class<?> fieldType)
Return a MethodHandle that provides read access to a field.MethodHandle
MethodHandles.Lookup. findSetter(Class<?> clazz, String fieldName, Class<?> fieldType)
Return a MethodHandle that provides write access to a field.MethodHandle
MethodHandles.Lookup. findSpecial(Class<?> clazz, String methodName, MethodType type, Class<?> specialToken)
Return a MethodHandle bound to a specific-implementation of a virtual method, as if created by an invokespecial bytecode using the class specialToken.MethodHandle
MethodHandles.Lookup. findStatic(Class<?> clazz, String methodName, MethodType type)
Return a MethodHandle to a static method.MethodHandle
MethodHandles.Lookup. findStaticGetter(Class<?> clazz, String fieldName, Class<?> fieldType)
Return a MethodHandle that provides read access to a field.MethodHandle
MethodHandles.Lookup. findStaticSetter(Class<?> clazz, String fieldName, Class<?> fieldType)
Return a MethodHandle that provides write access to a field.MethodHandle
MethodHandles.Lookup. findVirtual(Class<?> clazz, String methodName, MethodType type)
Return a MethodHandle to a virtual method.static MethodHandle
MethodHandles. foldArguments(MethodHandle handle, int foldPosition, MethodHandle preprocessor)
Produce a MethodHandle that preprocesses some of the arguments by calling the preprocessor handle.static MethodHandle
MethodHandles. foldArguments(MethodHandle handle, MethodHandle preprocessor)
Produce a MethodHandle that preprocesses some of the arguments by calling the preprocessor handle.abstract MethodHandle
CallSite. getTarget()
Return the target MethodHandle of the CallSite.MethodHandle
ConstantCallSite. getTarget()
Return the target MethodHandle of this CallSite.MethodHandle
VolatileCallSite. getTarget()
The target MethodHandle is returned as though by a read of a volatile variable.static MethodHandle
MethodHandles. guardWithTest(MethodHandle guard, MethodHandle trueTarget, MethodHandle falseTarget)
Produce a MethodHandle that implements an if-else block.MethodHandle
SwitchPoint. guardWithTest(MethodHandle target, MethodHandle fallback)
Returns a method handle which always delegates either to the target or the fallback.static MethodHandle
MethodHandles. identity(Class<?> classType)
Produce a MethodHandle that acts as an identity function.static MethodHandle
MethodHandles. insertArguments(MethodHandle originalHandle, int location, Object... values)
This method returns a method handle that delegates to the original method handle, adding a particular range of arguments (starting at a given location and with given types).static MethodHandle
MethodHandles. invoker(MethodType type)
Return a MethodHandle that is the equivalent of calling MethodHandles.lookup().findVirtual(MethodHandle.class, "invoke", type).static MethodHandle
MethodHandles. iteratedLoop(MethodHandle iteratorHandle, MethodHandle initHandle, MethodHandle bodyHandle)
Produce a loop handle that iterates over a range of values produced by anIterator<T>
Loop variables are updated by the return values of the corresponding step handles (including the loop body) in each iteration.static MethodHandle
MethodHandles. loop(MethodHandle[]... handleClauses)
Produce a loop handle that wraps the logic of loop with an array of MethodHandle clausesstatic MethodHandle
MethodHandles. permuteArguments(MethodHandle handle, MethodType permuteType, int... permute)
Produce a MethodHandle that will permute the incoming arguments according to the permute array.static MethodHandle
MethodHandles. spreadInvoker(MethodType type, int fixedArgCount)
Return a MethodHandle that is able to invoke a MethodHandle of type as though by invoke after spreading the final Object[] parameter.static MethodHandle
MethodHandles. throwException(Class<?> returnType, Class<? extends Throwable> exception)
Return a MethodHandle that will throw the passed in Exception object.MethodHandle
VarHandle. toMethodHandle(VarHandle.AccessMode accessMode)
This method creates aMethodHandle
for a specificVarHandle.AccessMode
.static MethodHandle
MethodHandles. tryFinally(MethodHandle tryHandle, MethodHandle finallyHandle)
Produce a MethodHandle that implements a try-finally block.MethodHandle
MethodHandles.Lookup. unreflect(Method method)
Make a MethodHandle to the Reflect method.MethodHandle
MethodHandles.Lookup. unreflectConstructor(Constructor<?> method)
Return a MethodHandle for the reflect constructor.MethodHandle
MethodHandles.Lookup. unreflectGetter(Field field)
Create a MethodHandle that returns the value of the Reflect field.MethodHandle
MethodHandles.Lookup. unreflectSetter(Field field)
Create a MethodHandle that sets the value of the Reflect field.MethodHandle
MethodHandles.Lookup. unreflectSpecial(Method method, Class<?> specialToken)
Return a MethodHandle for the Reflect method, that will directly call the requested method as through from the classspecialToken
.static MethodHandle
MethodHandles. varHandleExactInvoker(VarHandle.AccessMode accessMode, MethodType expectedType)
static MethodHandle
MethodHandles. varHandleInvoker(VarHandle.AccessMode accessMode, MethodType expectedType)
static MethodHandle
MethodHandles. whileLoop(MethodHandle initHandle, MethodHandle predHandle, MethodHandle bodyHandle)
Produce a loop handle that wraps an initializer, a loop body and a predicate to execute a while loop.MethodHandle
MethodHandle. withVarargs(boolean isVarArityNeeded)
Return a MethodHandle that is wrapped with an asVarargsCollector adapter if the handle is allowed to be variable arity.static MethodHandle
MethodHandleProxies. wrapperInstanceTarget(Object x)
Produces or recovers a target method handle which is behaviorally equivalent to the unique method of this wrapper instance.static MethodHandle
MethodHandles. zero(Class<?> targetType)
Produces a constant method handle with the default value for the requested target type.Methods in java.lang.invoke with parameters of type MethodHandle Modifier and Type Method Description static <T> T
MethodHandleProxies. asInterfaceInstance(Class<T> intfc, MethodHandle target)
Produces an instance of the given single-method interface which redirects its calls to the given method handle.static MethodHandle
MethodHandles. catchException(MethodHandle tryHandle, Class<? extends Throwable> throwableClass, MethodHandle catchHandle)
Produce a MethodHandle that implements a try-catch block.static MethodHandle
MethodHandles. collectArguments(MethodHandle target, int pos, MethodHandle filter)
Produce a MethodHandle that preprocesses some of the arguments by calling the filter handle.static MethodHandle
MethodHandles. countedLoop(MethodHandle loopCountHandle, MethodHandle initHandle, MethodHandle bodyHandle)
Produce a loop handle that executes a given number of iterations.static MethodHandle
MethodHandles. countedLoop(MethodHandle startHandle, MethodHandle endHandle, MethodHandle initHandle, MethodHandle bodyHandle)
Produce a loop handle that iterates over a range of numbers by specifying the start value and the end value of the loop counter.static MethodHandle
MethodHandles. doWhileLoop(MethodHandle initHandle, MethodHandle bodyHandle, MethodHandle predHandle)
Produce a loop handle that wraps an initializer, a loop body and a predicate to execute a do-while loop.static MethodHandle
MethodHandles. dropArguments(MethodHandle originalHandle, int location, Class<?>... valueTypes)
This method returns a method handle that delegates to the original method handle, ignoring a particular range of arguments (starting at a given location and with given types).static MethodHandle
MethodHandles. dropArguments(MethodHandle originalHandle, int location, List<Class<?>> valueTypes)
This method returns a method handle that delegates to the original method handle, ignoring a particular range of arguments (starting at a given location and with given types).static MethodHandle
MethodHandles. dropArgumentsToMatch(MethodHandle originalHandle, int skippedArgumentCount, List<Class<?>> valueTypes, int location)
This method returns a method handle that delegates to the original method handle, skipping over a specified number of arguments at the given location.static MethodHandle
MethodHandles. explicitCastArguments(MethodHandle handle, MethodType type)
Produce an adapter that converts the incoming arguments from type to the underlying MethodHandle's type and converts the return value as required.static MethodHandle
MethodHandles. filterArguments(MethodHandle handle, int startPosition, MethodHandle... filters)
Produce a MethodHandle that adapts its arguments using the filter methodhandles before calling the underlying handle.static MethodHandle
MethodHandles. filterReturnValue(MethodHandle handle, MethodHandle filter)
Return a MethodHandle that will adapt the return value of handle by running the filter on it and returning the result of the filter.static MethodHandle
MethodHandles. foldArguments(MethodHandle handle, int foldPosition, MethodHandle preprocessor)
Produce a MethodHandle that preprocesses some of the arguments by calling the preprocessor handle.static MethodHandle
MethodHandles. foldArguments(MethodHandle handle, MethodHandle preprocessor)
Produce a MethodHandle that preprocesses some of the arguments by calling the preprocessor handle.static MethodHandle
MethodHandles. guardWithTest(MethodHandle guard, MethodHandle trueTarget, MethodHandle falseTarget)
Produce a MethodHandle that implements an if-else block.MethodHandle
SwitchPoint. guardWithTest(MethodHandle target, MethodHandle fallback)
Returns a method handle which always delegates either to the target or the fallback.static MethodHandle
MethodHandles. insertArguments(MethodHandle originalHandle, int location, Object... values)
This method returns a method handle that delegates to the original method handle, adding a particular range of arguments (starting at a given location and with given types).static Object
ConstantBootstraps. invoke(MethodHandles.Lookup lookup, String name, Class<?> type, MethodHandle handle, Object... args)
Returns the result of invoking a method handle with the provided arguments.static MethodHandle
MethodHandles. iteratedLoop(MethodHandle iteratorHandle, MethodHandle initHandle, MethodHandle bodyHandle)
Produce a loop handle that iterates over a range of values produced by anIterator<T>
Loop variables are updated by the return values of the corresponding step handles (including the loop body) in each iteration.static MethodHandle
MethodHandles. loop(MethodHandle[]... handleClauses)
Produce a loop handle that wraps the logic of loop with an array of MethodHandle clausesstatic CallSite
LambdaMetafactory. metafactory(MethodHandles.Lookup caller, String invokedName, MethodType invokedType, MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType)
Facilitates the creation of simple "function objects" that implement one or more interfaces by delegation to a providedMethodHandle
, after appropriate type adaptation and partial evaluation of arguments.static MethodHandle
MethodHandles. permuteArguments(MethodHandle handle, MethodType permuteType, int... permute)
Produce a MethodHandle that will permute the incoming arguments according to the permute array.static <T extends Member>
TMethodHandles. reflectAs(Class<T> expected, MethodHandle target)
Gets the underlying Member of the providedtarget
MethodHandle.MethodHandleInfo
MethodHandles.Lookup. revealDirect(MethodHandle target)
Cracks a MethodHandle, which allows access to its symbolic parts.abstract void
CallSite. setTarget(MethodHandle nextTarget)
Set the CallSite's target to be nextTarget.void
ConstantCallSite. setTarget(MethodHandle newTarget)
Throws UnsupportedOperationException as a ConstantCallSite is permanently bound to its initial target MethodHandle.void
VolatileCallSite. setTarget(MethodHandle nextTarget)
Set the CallSite's target to be nextTarget.static MethodHandle
MethodHandles. tryFinally(MethodHandle tryHandle, MethodHandle finallyHandle)
Produce a MethodHandle that implements a try-finally block.static MethodHandle
MethodHandles. whileLoop(MethodHandle initHandle, MethodHandle predHandle, MethodHandle bodyHandle)
Produce a loop handle that wraps an initializer, a loop body and a predicate to execute a while loop.Constructors in java.lang.invoke with parameters of type MethodHandle Constructor Description ConstantCallSite(MethodHandle permanentTarget)
Create a ConstantCallSite with a target MethodHandle that cannot change.ConstantCallSite(MethodType targetType, MethodHandle hook)
Create a ConstantCallSite and assign the hook MethodHandle's result to its permanent target.MutableCallSite(MethodHandle mutableTarget)
Create a MutableCallSite permanently set to the same type as the mutableTarget and using the mutableTarget as the initial target value.VolatileCallSite(MethodHandle volatileTarget)
Create a VolatileCallSite with the same type as the volatileTarget and the initial target set to volatileTarget. -
Uses of MethodHandle in jdk.dynalink
Methods in jdk.dynalink with parameters of type MethodHandle Modifier and Type Method Description void
RelinkableCallSite. initialize(MethodHandle relinkAndInvoke)
Invoked by dynamic linker to initialize the relinkable call site by setting a relink-and-invoke method handle.void
RelinkableCallSite. relink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke)
This method will be called by the dynamic linker every time the call site is relinked (but seeRelinkableCallSite.resetAndRelink(GuardedInvocation, MethodHandle)
for an exception).void
RelinkableCallSite. resetAndRelink(GuardedInvocation guardedInvocation, MethodHandle relinkAndInvoke)
This method will be called by the dynamic linker every time the call site is relinked and the linker wishes the call site to throw away any prior linkage state (that is how it differs fromRelinkableCallSite.relink(GuardedInvocation, MethodHandle)
). -
Uses of MethodHandle in jdk.dynalink.beans
Methods in jdk.dynalink.beans that return MethodHandle Modifier and Type Method Description MethodHandle
MissingMemberHandlerFactory. createMissingMemberHandler(LinkRequest linkRequest, LinkerServices linkerServices)
Returns a method handle suitable for implementing missing member behavior for a particular link request. -
Uses of MethodHandle in jdk.dynalink.linker
Methods in jdk.dynalink.linker that return MethodHandle Modifier and Type Method Description MethodHandle
LinkerServices. asType(MethodHandle handle, MethodType fromType)
Similar toasType(MethodType)
except it also hooks in method handles produced by all availableGuardingTypeConverterFactory
implementations, providing for language-specific type coercing of parameters.MethodHandle
MethodTypeConversionStrategy. asType(MethodHandle target, MethodType newType)
Converts a method handle to a new type.default MethodHandle
LinkerServices. asTypeLosslessReturn(MethodHandle handle, MethodType fromType)
Similar toLinkerServices.asType(MethodHandle, MethodType)
except it treats return value type conversion specially.MethodHandle
GuardedInvocation. compose(MethodHandle fallback)
Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated.MethodHandle
GuardedInvocation. compose(MethodHandle guardFallback, MethodHandle switchpointFallback, MethodHandle catchFallback)
Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated.MethodHandle
LinkerServices. filterInternalObjects(MethodHandle target)
Modifies the method handle so that any parameters that can receive potentially internal language runtime objects will have a filter added on them to prevent them from escaping, potentially by wrapping them.MethodHandle
GuardedInvocation. getGuard()
Returns the guard method handle.MethodHandle
GuardedInvocation. getInvocation()
Returns the invocation method handle.MethodHandle
LinkerServices. getTypeConverter(Class<?> sourceType, Class<?> targetType)
Given a source and target type, returns a method handle that converts between them.MethodHandle
MethodHandleTransformer. transform(MethodHandle target)
Transforms a method handle.Methods in jdk.dynalink.linker with parameters of type MethodHandle Modifier and Type Method Description MethodHandle
LinkerServices. asType(MethodHandle handle, MethodType fromType)
Similar toasType(MethodType)
except it also hooks in method handles produced by all availableGuardingTypeConverterFactory
implementations, providing for language-specific type coercing of parameters.MethodHandle
MethodTypeConversionStrategy. asType(MethodHandle target, MethodType newType)
Converts a method handle to a new type.default MethodHandle
LinkerServices. asTypeLosslessReturn(MethodHandle handle, MethodType fromType)
Similar toLinkerServices.asType(MethodHandle, MethodType)
except it treats return value type conversion specially.MethodHandle
GuardedInvocation. compose(MethodHandle fallback)
Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated.MethodHandle
GuardedInvocation. compose(MethodHandle guardFallback, MethodHandle switchpointFallback, MethodHandle catchFallback)
Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated.GuardedInvocation
GuardedInvocation. filterArguments(int pos, MethodHandle... filters)
Applies argument filters to both the invocation and the guard (if it exists and has at leastpos + 1
parameters) withMethodHandles.filterArguments(MethodHandle, int, MethodHandle...)
.MethodHandle
LinkerServices. filterInternalObjects(MethodHandle target)
Modifies the method handle so that any parameters that can receive potentially internal language runtime objects will have a filter added on them to prevent them from escaping, potentially by wrapping them.GuardedInvocation
GuardedInvocation. replaceMethods(MethodHandle newInvocation, MethodHandle newGuard)
Creates a new guarded invocation with different methods, preserving the switch point.MethodHandle
MethodHandleTransformer. transform(MethodHandle target)
Transforms a method handle.Constructors in jdk.dynalink.linker with parameters of type MethodHandle Constructor Description GuardedInvocation(MethodHandle invocation)
Creates a new unconditional guarded invocation.GuardedInvocation(MethodHandle invocation, MethodHandle guard)
Creates a new guarded invocation, with a guard method handle.GuardedInvocation(MethodHandle invocation, MethodHandle guard, SwitchPoint switchPoint)
Creates a new guarded invocation, with both a guard method handle and a switch point that can be used to invalidate it.GuardedInvocation(MethodHandle invocation, MethodHandle guard, SwitchPoint[] switchPoints, Class<? extends Throwable> exception)
Creates a new guarded invocation, with a guard method handle, any number of switch points that can be used to invalidate it, and an exception that if thrown when invoked also invalidates it.GuardedInvocation(MethodHandle invocation, MethodHandle guard, SwitchPoint switchPoint, Class<? extends Throwable> exception)
Creates a new guarded invocation, with a guard method handle, a switch point that can be used to invalidate it, and an exception that if thrown when invoked also invalidates it.GuardedInvocation(MethodHandle invocation, SwitchPoint switchPoint)
Creates a new guarded invocation that can be invalidated by a switch point. -
Uses of MethodHandle in jdk.dynalink.linker.support
Methods in jdk.dynalink.linker.support that return MethodHandle Modifier and Type Method Description static MethodHandle
Guards. asType(MethodHandle test, MethodType type)
Takes a method handle intended to be used as a guard, and adapts it to the requested type, but returning a boolean.static MethodHandle
Guards. asType(LinkerServices linkerServices, MethodHandle test, MethodType type)
Takes a method handle intended to be used as a guard, and adapts it to the requested type, but returning a boolean.MethodHandle
Lookup. findGetter(Class<?> refc, String name, Class<?> type)
Performs aMethodHandles.Lookup.findGetter(Class, String, Class)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
andNoSuchFieldException
into aNoSuchFieldError
.static MethodHandle
Lookup. findOwnSpecial(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes)
Given a lookup, finds usingLookup.findSpecial(Class, String, MethodType)
a method on that lookup's class.MethodHandle
Lookup. findOwnSpecial(String name, Class<?> rtype, Class<?>... ptypes)
Finds usingLookup.findSpecial(Class, String, MethodType)
a method on that lookup's class.static MethodHandle
Lookup. findOwnStatic(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes)
Given a lookup, finds usingLookup.findStatic(Class, String, MethodType)
a method on that lookup's class.MethodHandle
Lookup. findOwnStatic(String name, Class<?> rtype, Class<?>... ptypes)
Finds usingLookup.findStatic(Class, String, MethodType)
a method on that lookup's class.MethodHandle
Lookup. findSpecial(Class<?> declaringClass, String name, MethodType type)
Performs aMethodHandles.Lookup.findSpecial(Class, String, MethodType, Class)
on the underlying lookup.MethodHandle
Lookup. findStatic(Class<?> declaringClass, String name, MethodType type)
Performs aMethodHandles.Lookup.findStatic(Class, String, MethodType)
on the underlying lookup.MethodHandle
Lookup. findVirtual(Class<?> declaringClass, String name, MethodType type)
Performs aMethodHandles.Lookup.findVirtual(Class, String, MethodType)
on the underlying lookup.static MethodHandle
Guards. getClassGuard(Class<?> clazz)
Creates a guard method that tests its only argument for being of an exact particular class.static MethodHandle
Guards. getIdentityGuard(Object obj)
Creates a guard method that tests its only argument for being referentially identical to another objectstatic MethodHandle
Guards. getInstanceOfGuard(Class<?> clazz)
Creates a guard method that tests its only argument for being an instance of a particular class.static MethodHandle
Guards. isArray(int pos, MethodType type)
Creates a method handle that returns true if the argument in the specified position is a Java array.static MethodHandle
Guards. isInstance(Class<?> clazz, int pos, MethodType type)
Creates a method handle with arguments of a specified type, but with boolean return value.static MethodHandle
Guards. isInstance(Class<?> clazz, MethodType type)
Creates a method handle with arguments of a specified type, but with boolean return value.static MethodHandle
Guards. isNotNull()
Returns a guard that tests whether the first argument is not null.static MethodHandle
Guards. isNull()
Returns a guard that tests whether the first argument is null.static MethodHandle
Guards. isOfClass(Class<?> clazz, MethodType type)
Creates a guard method handle with arguments of a specified type, but with boolean return value.static MethodHandle
Lookup. unreflect(MethodHandles.Lookup lookup, Method m)
Performs aMethodHandles.Lookup.unreflect(Method)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
.MethodHandle
Lookup. unreflect(Method m)
Performs aMethodHandles.Lookup.unreflect(Method)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
.static MethodHandle
Lookup. unreflectConstructor(MethodHandles.Lookup lookup, Constructor<?> c)
Performs aMethodHandles.Lookup.unreflectConstructor(Constructor)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
.MethodHandle
Lookup. unreflectConstructor(Constructor<?> c)
Performs aMethodHandles.Lookup.unreflectConstructor(Constructor)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
.MethodHandle
Lookup. unreflectGetter(Field f)
Performs aMethodHandles.Lookup.unreflectGetter(Field)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
.MethodHandle
Lookup. unreflectSetter(Field f)
Performs aMethodHandles.Lookup.unreflectSetter(Field)
, converting any encounteredIllegalAccessException
into anIllegalAccessError
.Methods in jdk.dynalink.linker.support with parameters of type MethodHandle Modifier and Type Method Description static MethodHandle
Guards. asType(MethodHandle test, MethodType type)
Takes a method handle intended to be used as a guard, and adapts it to the requested type, but returning a boolean.static MethodHandle
Guards. asType(LinkerServices linkerServices, MethodHandle test, MethodType type)
Takes a method handle intended to be used as a guard, and adapts it to the requested type, but returning a boolean.Constructors in jdk.dynalink.linker.support with parameters of type MethodHandle Constructor Description DefaultInternalObjectFilter(MethodHandle parameterFilter, MethodHandle returnFilter)
Creates a new filter.
-