MethodHandles.VarHandleInvoker(VarHandle+AccessMode, MethodType) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Produces a special invoker method handle which can be used to invoke a signature-polymorphic access mode method on any VarHandle whose associated access mode type is compatible with the given type.
[Android.Runtime.Register("varHandleInvoker", "(Ljava/lang/invoke/VarHandle$AccessMode;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=33)]
public static Java.Lang.Invoke.MethodHandle? VarHandleInvoker(Java.Lang.Invoke.VarHandle.AccessMode? accessMode, Java.Lang.Invoke.MethodType? type);
[<Android.Runtime.Register("varHandleInvoker", "(Ljava/lang/invoke/VarHandle$AccessMode;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=33)>]
static member VarHandleInvoker : Java.Lang.Invoke.VarHandle.AccessMode * Java.Lang.Invoke.MethodType -> Java.Lang.Invoke.MethodHandle
Parameters
- accessMode
- VarHandle.AccessMode
the VarHandle access mode
- type
- MethodType
the desired target type
Returns
a method handle suitable for invoking an access mode method of any VarHandle whose access mode type is convertible to the given type.
- Attributes
Remarks
Produces a special invoker method handle which can be used to invoke a signature-polymorphic access mode method on any VarHandle whose associated access mode type is compatible with the given type. The resulting invoker will have a type which is exactly equal to the desired given type, except that it will accept an additional leading argument of type VarHandle. Before invoking its target, if the access mode type differs from the desired given type, the invoker will apply reference casts as necessary and box, unbox, or widen primitive values, as if by asType. Similarly, the return value will be converted as necessary. This method is equivalent to the following code (though it may be more efficient): publicLookup().findVirtual(VarHandle.class, accessMode.name(), type)
Java reference for java.lang.invoke.MethodHandles.varHandleInvoker.