Udostępnij za pośrednictwem


MethodHandles.DropArgumentsToMatch Method

Definition

Adapts a target method handle to match the given parameter type list.

[Android.Runtime.Register("dropArgumentsToMatch", "(Ljava/lang/invoke/MethodHandle;ILjava/util/List;I)Ljava/lang/invoke/MethodHandle;", "", ApiSince=33)]
public static Java.Lang.Invoke.MethodHandle? DropArgumentsToMatch (Java.Lang.Invoke.MethodHandle? target, int skip, System.Collections.Generic.IList<Java.Lang.Class>? newTypes, int pos);
[<Android.Runtime.Register("dropArgumentsToMatch", "(Ljava/lang/invoke/MethodHandle;ILjava/util/List;I)Ljava/lang/invoke/MethodHandle;", "", ApiSince=33)>]
static member DropArgumentsToMatch : Java.Lang.Invoke.MethodHandle * int * System.Collections.Generic.IList<Java.Lang.Class> * int -> Java.Lang.Invoke.MethodHandle

Parameters

target
MethodHandle

the method handle to adapt

skip
Int32

number of targets parameters to disregard (they will be unchanged)

newTypes
IList<Class>

the list of types to match target's parameter type list to

pos
Int32

place in newTypes where the non-skipped target parameters must occur

Returns

a possibly adapted method handle

Attributes

Remarks

Adapts a target method handle to match the given parameter type list. If necessary, adds placeholder arguments. Some leading parameters can be skipped before matching begins. The remaining types in the target's parameter type list must be a sub-list of the newTypes type list at the starting position pos. The resulting handle will have the target handle's parameter type list, with any non-matching parameter types (before or after the matching sub-list) inserted in corresponding positions of the target's original parameters, as if by #dropArguments(MethodHandle, int, Class[]).

The resulting handle will have the same return type as the target handle.

In more formal terms, assume these two type lists:<ul> <li>The target handle has the parameter type list S..., M..., with as many types in S as indicated by skip. The M types are those that are supposed to match part of the given type list, newTypes. <li>The newTypes list contains types P..., M..., A..., with as many types in P as indicated by pos. The M types are precisely those that the M types in the target handle's parameter type list are supposed to match. The types in A are additional types found after the matching sub-list. </ul> Given these assumptions, the result of an invocation of dropArgumentsToMatch will have the parameter type list S..., P..., M..., A..., with the P and A types inserted as if by #dropArguments(MethodHandle, int, Class[]).

Added in 9.

Java documentation for java.lang.invoke.MethodHandles.dropArgumentsToMatch(java.lang.invoke.MethodHandle, int, java.util.List<java.lang.Class<?>>, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to