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 |
---|---|
MethodType |
MethodType.appendParameterTypes(Class<?>... classes)
Returns a MethodType with the additional class types appended to the end.
|
MethodType |
MethodType.appendParameterTypes(List<Class<?>> classes)
Returns a MethodType with the additional class types appended to the end.
|
MethodType |
MethodType.changeParameterType(int position,
Class<?> type)
Convenience method to create a new MethodType with only the parameter at
position changed to the new type.
|
MethodType |
MethodType.changeReturnType(Class<?> type)
Convenience method to create a new MethodType with a changed return type.
|
MethodType |
MethodType.dropParameterTypes(int startPosition,
int endPosition)
Convenience method to create a new MethodType after dropping the
parameters between startPosition and endPosition.
|
MethodType |
MethodType.erase()
Convenience method erase all reference types to Object.
|
static MethodType |
MethodType.fromMethodDescriptorString(String methodDescriptor,
ClassLoader loader)
Convenience Method to create a MethodType from bytecode-level method descriptor.
|
MethodType |
MethodType.generic()
Convenience method to convert all types to Object.
|
static MethodType |
MethodType.genericMethodType(int numParameters)
Static helper method to create a MethodType with only Object return type and parameters.
|
static MethodType |
MethodType.genericMethodType(int numParameters,
boolean isVarargs)
Wrapper on
methodType(Class, Class[]) . |
MethodType |
MethodHandleInfo.getMethodType()
Returns the type of the MethodHandle's underlying member as a MethodType.
|
MethodType |
MethodType.insertParameterTypes(int position,
Class<?>... types)
Return a new MethodType with an additional parameters inserted at position, which
is a zero based index.
|
MethodType |
MethodType.insertParameterTypes(int position,
List<Class<?>> types)
Return a new MethodType with an additional parameters inserted at position, which
is a zero based index.
|
static MethodType |
MethodType.methodType(Class<?> type)
Create a MethodType object with the specified return type and no parameters
|
static MethodType |
MethodType.methodType(Class<?> type,
Class<?> parameter0)
Return a MethodType object with the specified return type and a single parameter
of type 'parameter0'.
|
static MethodType |
MethodType.methodType(Class<?> returnType,
Class<?>[] parameters)
Return a MethodType object with the parameter and return types as requested.
|
static MethodType |
MethodType.methodType(Class<?> type,
Class<?> parameter0,
Class<?>... parameters)
Wrapper on
methodType(Class, Class[]) . |
static MethodType |
MethodType.methodType(Class<?> type,
List<Class<?>> parameters)
Wrapper on
methodType(Class, Class[]) |
static MethodType |
MethodType.methodType(Class<?> returnType,
MethodType methodType)
Wrapper on
methodType(Class, Class[]) . |
MethodType |
CallSite.type()
Report the type of CallSite's target MethodHandle.
|
MethodType |
MethodHandle.type()
The MethodType of the MethodHandle.
|
MethodType |
MethodType.unwrap()
Wrapper method on
methodType(Class, Class[]) . |
MethodType |
MethodType.wrap()
Wrapper method on
methodType(Class, Class[]) . |
Modifier and Type | Method and Description |
---|---|
static CallSite |
LambdaMetafactory.altMetafactory(MethodHandles.Lookup caller,
String invokedName,
MethodType invokedType,
Object... args)
Facilitates the creation of simple "function objects" that implement one
or more interfaces by delegation to a provided
MethodHandle ,
after appropriate type adaptation and partial evaluation of arguments. |
MethodHandle |
MethodHandle.asType(MethodType newType)
Returns a MethodHandle that presents as being of MethodType newType.
|
MethodHandle |
MethodHandles.Lookup.bind(Object receiver,
String methodName,
MethodType type)
Return an early-bound method handle to a non-static method.
|
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.
|
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.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.findVirtual(Class<?> clazz,
String methodName,
MethodType type)
Return a MethodHandle to a virtual method.
|
static MethodHandle |
MethodHandles.invoker(MethodType type)
Return a MethodHandle that is the equivalent of calling
MethodHandles.lookup().findVirtual(MethodHandle.class, "invoke", type).
|
static 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 provided
MethodHandle ,
after appropriate type adaptation and partial evaluation of arguments. |
static MethodType |
MethodType.methodType(Class<?> returnType,
MethodType methodType)
Wrapper on
methodType(Class, Class[]) . |
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 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 String |
MethodHandleInfo.toString(int kind,
Class<?> defc,
String name,
MethodType type)
Answers a string containing a concise, human-readable description of the receiver.
|
Constructor and Description |
---|
ConstantCallSite(MethodType targetType,
MethodHandle hook)
Create a ConstantCallSite and assign the hook MethodHandle's result to its permanent target.
|
MutableCallSite(MethodType type)
Create a MutableCallSite with the MethodType type and an
initial target that throws IllegalStateException.
|
VolatileCallSite(MethodType type)
Create a VolatileCallSite with the MethodType type and an
initial target that throws IllegalStateException.
|
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, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.