次の方法で共有


MethodHandles.Lookup.Unreflect(Method) Method

Definition

Makes a direct method handle to m, if the lookup class has permission.

[Android.Runtime.Register("unreflect", "(Ljava/lang/reflect/Method;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public Java.Lang.Invoke.MethodHandle Unreflect (Java.Lang.Reflect.Method m);
[<Android.Runtime.Register("unreflect", "(Ljava/lang/reflect/Method;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
member this.Unreflect : Java.Lang.Reflect.Method -> Java.Lang.Invoke.MethodHandle

Parameters

m
Method

the reflected method

Returns

a method handle which can invoke the reflected method

Attributes

Remarks

Makes a direct method handle to m, if the lookup class has permission. If m is non-static, the receiver argument is treated as an initial argument. If m is virtual, overriding is respected on every call. Unlike the Core Reflection API, exceptions are <em>not</em> wrapped. The type of the method handle will be that of the method, with the receiver type prepended (but only if it is non-static). If the method's accessible flag is not set, access checking is performed immediately on behalf of the lookup class. If m is not public, do not share the resulting handle with untrusted parties.

The returned method handle will have MethodHandle#asVarargsCollector variable arity if and only if the method's variable arity modifier bit (0x0080) is set.

If m is static, and if the returned method handle is invoked, the method's class will be initialized, if it has not already been initialized.

Java documentation for java.lang.invoke.MethodHandles.Lookup.unreflect(java.lang.reflect.Method).

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