MethodHandles.ReflectAs(Class, MethodHandle) 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.
Performs an unchecked "crack" of a direct method handle.
[Android.Runtime.Register("reflectAs", "(Ljava/lang/Class;Ljava/lang/invoke/MethodHandle;)Ljava/lang/reflect/Member;", "", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.reflect.Member" })]
public static Java.Lang.Object? ReflectAs (Java.Lang.Class? expected, Java.Lang.Invoke.MethodHandle? target);
[<Android.Runtime.Register("reflectAs", "(Ljava/lang/Class;Ljava/lang/invoke/MethodHandle;)Ljava/lang/reflect/Member;", "", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.reflect.Member" })>]
static member ReflectAs : Java.Lang.Class * Java.Lang.Invoke.MethodHandle -> Java.Lang.Object
Parameters
- expected
- Class
a class object representing the desired result type T
- target
- MethodHandle
a direct method handle to crack into symbolic reference components
Returns
a reference to the method, constructor, or field object
- Attributes
Remarks
Performs an unchecked "crack" of a direct method handle. The result is as if the user had obtained a lookup object capable enough to crack the target method handle, called java.lang.invoke.MethodHandles.Lookup#revealDirect Lookup.revealDirect
on the target to obtain its symbolic reference, and then called java.lang.invoke.MethodHandleInfo#reflectAs MethodHandleInfo.reflectAs
to resolve the symbolic reference to a member.
If there is a security manager, its checkPermission
method is called with a ReflectPermission("suppressAccessChecks")
permission.
Added in 1.8.
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.