## Uses of Class
java.lang.invoke.MethodHandle

- Packages that use MethodHandle
  Package | Description
  --- | ---
  java.lang.invoke |

- - ### Uses of MethodHandle in java.lang.invoke

    Methods in java.lang.invoke that return MethodHandle
    Modifier and Type | Method and Description
    --- | ---
    `MethodHandle` | MethodHandle.`asCollector(Class<?> arrayType, int arrayLength)` Makes an array-collecting method handle, which accepts a given number of trailing positional arguments and collects them into an array argument.
    `MethodHandle` | MethodHandle.`asFixedArity()` Makes a fixed arity method handle which is otherwise equivalent to the current method handle.
    `MethodHandle` | MethodHandle.`asSpreader(Class<?> arrayType, int arrayLength)` Makes an array-spreading method handle, 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.
    `abstract MethodHandle` | CallSite.`dynamicInvoker()` Produces a method handle equivalent to an invokedynamic instruction which has been linked to this call site.
    `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.
    `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.
    `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` | 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.

    Methods in java.lang.invoke with parameters of type MethodHandle
    Modifier and Type | Method and Description
    --- | ---
    `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 <T extends Member> T` | MethodHandles.`reflectAs(Class<T> expected, MethodHandle target)` Performs an unchecked "crack" of a direct method handle.
    `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.

Copyright © 2025 API Design. All Rights Reserved.