Package | Description |
---|---|
java.lang.invoke |
The
java.lang.invoke package contains dynamic language support provided directly by
the Java core class libraries and virtual machine. |
Modifier and Type | Method and Description |
---|---|
static MethodHandle |
MethodHandles.arrayElementGetter(Class<?> arrayClass)
Produces a method handle giving read access to elements of an array.
|
static MethodHandle |
MethodHandles.arrayElementSetter(Class<?> arrayClass)
Produces a method handle giving write access to elements of an array.
|
MethodHandle |
MethodHandle.asCollector(Class<?> arrayType,
int arrayLength)
Makes an adapter which accepts a given number of trailing
positional arguments and collects them into an array argument.
|
MethodHandle |
MethodHandle.asSpreader(Class<?> arrayType,
int arrayLength)
Makes an adapter which accepts a trailing array argument
and spreads its elements as positional arguments.
|
MethodHandle |
MethodHandle.asType(MethodType newType)
Produces an adapter method handle which adapts the type of the
current method handle to a new type.
|
MethodHandle |
MethodHandle.asVarargsCollector(Class<?> arrayType)
Makes a variable arity adapter which is able to accept
any number of trailing positional arguments and collect them
into an array argument.
|
MethodHandle |
MethodHandles.Lookup.bind(Object receiver,
String name,
MethodType type)
Produces an early-bound method handle for a non-static method.
|
MethodHandle |
MethodHandle.bindTo(Object x)
Binds a value
x to the first argument of a method handle, without invoking it. |
static MethodHandle |
MethodHandles.catchException(MethodHandle target,
Class<? extends Throwable> exType,
MethodHandle handler)
Makes a method handle which adapts a target method handle,
by running it inside an exception handler.
|
static MethodHandle |
MethodHandles.constant(Class<?> type,
Object value)
Produces a method handle of the requested return type which returns the given
constant value every time it is invoked.
|
static MethodHandle |
MethodHandles.convertArguments(MethodHandle target,
MethodType newType)
Produces a method handle which adapts the type of the
given method handle to a new type by pairwise argument conversion.
|
static MethodHandle |
MethodHandles.dropArguments(MethodHandle target,
int pos,
Class<?>... valueTypes)
Produces a method handle which calls the original method handle,
after dropping the given argument(s) at the given position.
|
static MethodHandle |
MethodHandles.dropArguments(MethodHandle target,
int pos,
List<Class<?>> valueTypes)
Produces a method handle which calls the original method handle,
after dropping the given argument(s) at the given position.
|
MethodHandle |
VolatileCallSite.dynamicInvoker()
Produces a method handle equivalent to an invokedynamic instruction
which has been linked to this call site.
|
MethodHandle |
MutableCallSite.dynamicInvoker()
Produces a method handle equivalent to an invokedynamic instruction
which has been linked to this call site.
|
MethodHandle |
ConstantCallSite.dynamicInvoker()
Returns this call site's permanent target.
|
abstract MethodHandle |
CallSite.dynamicInvoker()
Produces a method handle equivalent to an invokedynamic instruction
which has been linked to this call site.
|
static MethodHandle |
MethodHandles.exactInvoker(MethodType type)
Produces a special invoker method handle which can be used to
invoke any method handle of the given type, as if by
invokeExact . |
static MethodHandle |
MethodHandles.explicitCastArguments(MethodHandle target,
MethodType newType)
Produces a method handle which adapts the type of the
given method handle to a new type by pairwise argument conversion.
|
static MethodHandle |
MethodHandles.filterArguments(MethodHandle target,
int pos,
MethodHandle... filters)
Adapts a target method handle
target by pre-processing
one or more of its arguments, each with its own unary filter function,
and then calling the target with each pre-processed argument
replaced by the result of its corresponding filter function. |
static MethodHandle |
MethodHandles.filterReturnValue(MethodHandle target,
MethodHandle filter)
Adapts a target method handle
target by post-processing
its return value with a unary filter function. |
MethodHandle |
MethodHandles.Lookup.findConstructor(Class<?> refc,
MethodType type)
Produces a method handle which creates an object and initializes it, using
the constructor of the specified type.
|
MethodHandle |
MethodHandles.Lookup.findGetter(Class<?> refc,
String name,
Class<?> type)
Produces a method handle giving read access to a non-static field.
|
MethodHandle |
MethodHandles.Lookup.findSetter(Class<?> refc,
String name,
Class<?> type)
Produces a method handle giving write access to a non-static field.
|
MethodHandle |
MethodHandles.Lookup.findSpecial(Class<?> refc,
String name,
MethodType type,
Class<?> specialCaller)
Produces an early-bound method handle for a virtual method,
as if called from an
invokespecial
instruction from caller . |
MethodHandle |
MethodHandles.Lookup.findStatic(Class<?> refc,
String name,
MethodType type)
Produces a method handle for a static method.
|
MethodHandle |
MethodHandles.Lookup.findStaticGetter(Class<?> refc,
String name,
Class<?> type)
Produces a method handle giving read access to a static field.
|
MethodHandle |
MethodHandles.Lookup.findStaticSetter(Class<?> refc,
String name,
Class<?> type)
Produces a method handle giving write access to a static field.
|
MethodHandle |
MethodHandles.Lookup.findVirtual(Class<?> refc,
String name,
MethodType type)
Produces a method handle for a virtual method.
|
static MethodHandle |
MethodHandles.foldArguments(MethodHandle target,
MethodHandle combiner)
Adapts a target method handle
target by pre-processing
some of its arguments, and then calling the target with
the result of the pre-processing, plus all original arguments. |
static MethodHandle |
MethodHandles.genericInvoker(MethodType type)
Produces a special invoker method handle which can be used to
invoke any method handle of the given type, as if by
invokeGeneric . |
MethodHandle |
VolatileCallSite.getTarget()
Returns the target method of the call site, which behaves
like a
volatile field of the VolatileCallSite . |
MethodHandle |
MutableCallSite.getTarget()
Returns the target method of the call site, which behaves
like a normal field of the
MutableCallSite . |
MethodHandle |
ConstantCallSite.getTarget()
Returns the target method of the call site, which behaves
like a
final field of the ConstantCallSite . |
abstract MethodHandle |
CallSite.getTarget()
Returns the target method of the call site, according to the
behavior defined by this call site's specific class.
|
MethodHandle |
SwitchPoint.guardWithTest(MethodHandle target,
MethodHandle fallback)
Returns a method handle which always delegates either to the target or the fallback.
|
static MethodHandle |
MethodHandles.guardWithTest(MethodHandle test,
MethodHandle target,
MethodHandle fallback)
Makes a method handle which adapts a target method handle,
by guarding it with a test, a boolean-valued method handle.
|
static MethodHandle |
MethodHandles.identity(Class<?> type)
Produces a method handle which returns its sole argument when invoked.
|
static MethodHandle |
MethodHandles.insertArguments(MethodHandle target,
int pos,
Object... values)
Produces a method handle which calls the original method handle
target ,
after inserting the given argument(s) at the given position. |
static MethodHandle |
MethodHandles.permuteArguments(MethodHandle target,
MethodType newType,
int... reorder)
Produces a method handle which adapts the calling sequence of the
given method handle to a new type, by reordering the arguments.
|
static MethodHandle |
MethodHandles.spreadInvoker(MethodType type,
int objectArgCount)
Produces a method handle which will invoke any method handle of the
given
type on a standard set of Object type arguments
and a single trailing Object[] array. |
static MethodHandle |
MethodHandles.throwException(Class<?> returnType,
Class<? extends Throwable> exType)
Produces a method handle which will throw exceptions of the given
exType . |
MethodHandle |
MethodHandles.Lookup.unreflect(Method m)
Makes a direct method handle to m, if the lookup class has permission.
|
MethodHandle |
MethodHandles.Lookup.unreflectConstructor(Constructor c)
Produces a method handle for a reflected constructor.
|
MethodHandle |
MethodHandles.Lookup.unreflectGetter(Field f)
Produces a method handle giving read access to a reflected field.
|
MethodHandle |
MethodHandles.Lookup.unreflectSetter(Field f)
Produces a method handle giving write access to a reflected field.
|
MethodHandle |
MethodHandles.Lookup.unreflectSpecial(Method m,
Class<?> specialCaller)
Produces a method handle for a reflected method.
|
static MethodHandle |
MethodHandles.wrapperInstanceTarget(Object x)
Produces or recovers a target method handle which is behaviorally
equivalent to the unique method of this wrapper instance.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
MethodHandles.asInstance(MethodHandle target,
Class<T> smType)
Produces an instance of the given single-method interface which redirects
its calls to the given method handle.
|
static MethodHandle |
MethodHandles.catchException(MethodHandle target,
Class<? extends Throwable> exType,
MethodHandle handler)
Makes a method handle which adapts a target method handle,
by running it inside an exception handler.
|
static MethodHandle |
MethodHandles.convertArguments(MethodHandle target,
MethodType newType)
Produces a method handle which adapts the type of the
given method handle to a new type by pairwise argument conversion.
|
static MethodHandle |
MethodHandles.dropArguments(MethodHandle target,
int pos,
Class<?>... valueTypes)
Produces a method handle which calls the original method handle,
after dropping the given argument(s) at the given position.
|
static MethodHandle |
MethodHandles.dropArguments(MethodHandle target,
int pos,
List<Class<?>> valueTypes)
Produces a method handle which calls the original method handle,
after dropping the given argument(s) at the given position.
|
static MethodHandle |
MethodHandles.explicitCastArguments(MethodHandle target,
MethodType newType)
Produces a method handle which adapts the type of the
given method handle to a new type by pairwise argument conversion.
|
static MethodHandle |
MethodHandles.filterArguments(MethodHandle target,
int pos,
MethodHandle... filters)
Adapts a target method handle
target by pre-processing
one or more of its arguments, each with its own unary filter function,
and then calling the target with each pre-processed argument
replaced by the result of its corresponding filter function. |
static MethodHandle |
MethodHandles.filterArguments(MethodHandle target,
int pos,
MethodHandle... filters)
Adapts a target method handle
target by pre-processing
one or more of its arguments, each with its own unary filter function,
and then calling the target with each pre-processed argument
replaced by the result of its corresponding filter function. |
static MethodHandle |
MethodHandles.filterReturnValue(MethodHandle target,
MethodHandle filter)
Adapts a target method handle
target by post-processing
its return value with a unary filter function. |
static MethodHandle |
MethodHandles.foldArguments(MethodHandle target,
MethodHandle combiner)
Adapts a target method handle
target by pre-processing
some of its arguments, and then calling the target with
the result of the pre-processing, plus all original arguments. |
MethodHandle |
SwitchPoint.guardWithTest(MethodHandle target,
MethodHandle fallback)
Returns a method handle which always delegates either to the target or the fallback.
|
static MethodHandle |
MethodHandles.guardWithTest(MethodHandle test,
MethodHandle target,
MethodHandle fallback)
Makes a method handle which adapts a target method handle,
by guarding it with a test, a boolean-valued method handle.
|
static MethodHandle |
MethodHandles.insertArguments(MethodHandle target,
int pos,
Object... values)
Produces a method handle which calls the original method handle
target ,
after inserting the given argument(s) at the given position. |
static MethodHandle |
MethodHandles.permuteArguments(MethodHandle target,
MethodType newType,
int... reorder)
Produces a method handle which adapts the calling sequence of the
given method handle to a new type, by reordering the arguments.
|
void |
VolatileCallSite.setTarget(MethodHandle newTarget)
Updates the target method of this call site, as a volatile variable.
|
void |
MutableCallSite.setTarget(MethodHandle newTarget)
Updates the target method of this call site, as a normal variable.
|
void |
ConstantCallSite.setTarget(MethodHandle ignore)
Always throws an
UnsupportedOperationException . |
abstract void |
CallSite.setTarget(MethodHandle newTarget)
Updates the target method of this call site, according to the
behavior defined by this call site's specific class.
|
Constructor and Description |
---|
ConstantCallSite(MethodHandle target)
Creates a call site with a permanent target.
|
MutableCallSite(MethodHandle target)
Creates a call site object with an initial target method handle.
|
VolatileCallSite(MethodHandle target)
Creates a call site with a volatile binding to its target.
|
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.
DRAFT ea-b138