Uses of Class java.lang.invoke.MethodType (Java Platform SE 8 )
Date: 2023-01-18

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

- Packages that use MethodType
  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.

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

    Methods in java.lang.invoke that return MethodType
    Modifier and Type | Method and Description
    --- | ---
    `MethodType` | MethodType.`appendParameterTypes(Class<?>... ptypesToInsert)` Finds or creates a method type with additional parameter types.
    `MethodType` | MethodType.`appendParameterTypes(List<Class<?>> ptypesToInsert)` Finds or creates a method type with additional parameter types.
    `MethodType` | MethodType.`changeParameterType(int num, Class<?> nptype)` Finds or creates a method type with a single different parameter type.
    `MethodType` | MethodType.`changeReturnType(Class<?> nrtype)` Finds or creates a method type with a different return type.
    `MethodType` | MethodType.`dropParameterTypes(int start, int end)` Finds or creates a method type with some parameter types omitted.
    `MethodType` | MethodType.`erase()` Erases all reference types to `Object`.
    `static MethodType` | MethodType.`fromMethodDescriptorString(String descriptor, ClassLoader loader)` Finds or creates an instance of a method type, given the spelling of its bytecode descriptor.
    `MethodType` | MethodType.`generic()` Converts all types, both reference and primitive, to `Object`.
    `static MethodType` | MethodType.`genericMethodType(int objectArgCount)` Finds or creates a method type whose components are all `Object`.
    `static MethodType` | MethodType.`genericMethodType(int objectArgCount, boolean finalArray)` Finds or creates a method type whose components are `Object` with an optional trailing `Object[]` array.
    `MethodType` | MethodHandleInfo.`getMethodType()` Returns the nominal type of the cracked symbolic reference, expressed as a method type.
    `MethodType` | MethodType.`insertParameterTypes(int num, Class<?>... ptypesToInsert)` Finds or creates a method type with additional parameter types.
    `MethodType` | MethodType.`insertParameterTypes(int num, List<Class<?>> ptypesToInsert)` Finds or creates a method type with additional parameter types.
    `static MethodType` | MethodType.`methodType(Class<?> rtype)` Finds or creates a method type with the given components.
    `static MethodType` | MethodType.`methodType(Class<?> rtype, Class<?> ptype0)` Finds or creates a method type with the given components.
    `static MethodType` | MethodType.`methodType(Class<?> rtype, Class<?>[] ptypes)` Finds or creates an instance of the given method type.
    `static MethodType` | MethodType.`methodType(Class<?> rtype, Class<?> ptype0, Class<?>... ptypes)` Finds or creates a method type with the given components.
    `static MethodType` | MethodType.`methodType(Class<?> rtype, List<Class<?>> ptypes)` Finds or creates a method type with the given components.
    `static MethodType` | MethodType.`methodType(Class<?> rtype, MethodType ptypes)` Finds or creates a method type with the given components.
    `MethodType` | CallSite.`type()` Returns the type of this call site's target.
    `MethodType` | MethodHandle.`type()` Reports the type of this method handle.
    `MethodType` | MethodType.`unwrap()` Converts all wrapper types to their corresponding primitive types.
    `MethodType` | MethodType.`wrap()` Converts all primitive types to their corresponding wrapper types.

    Methods in java.lang.invoke with parameters of type MethodType
    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)` Produces an adapter method handle which adapts the type of the current method handle to a new type.
    `MethodHandle` | MethodHandles.Lookup.`bind(Object receiver, String name, MethodType type)` Produces an early-bound method handle for a non-static method.
    `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 and return type conversion.
    `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.`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.`findVirtual(Class<?> refc, String name, MethodType type)` Produces a method handle for a virtual method.
    `static MethodHandle` | MethodHandles.`invoker(MethodType type)` Produces a special invoker method handle which can be used to invoke any method handle compatible with the given type, as if by `invoke`.
    `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<?> rtype, MethodType ptypes)` Finds or creates a method type with the given components.
    `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 leadingArgCount)` Produces a method handle which will invoke any method handle of the given `type`, with a given number of trailing arguments replaced by a single trailing `Object[]` array.
    `static String` | MethodHandleInfo.`toString(int kind, Class<?> defc, String name, MethodType type)` Returns a string representation for a `MethodHandleInfo`, given the four parts of its symbolic reference.

    Constructors in java.lang.invoke with parameters of type MethodType
    Constructor and Description
    `ConstantCallSite(MethodType targetType, MethodHandle createTargetHook)` Creates a call site with a permanent target, possibly bound to the call site itself.
    `MutableCallSite(MethodType type)` Creates a blank call site object with the given method type.
    `VolatileCallSite(MethodType type)` 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, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.