Share via


MethodHandles.Lookup.UnreflectConstructor(Constructor) Method

Definition

Produces a method handle for a reflected constructor.

[Android.Runtime.Register("unreflectConstructor", "(Ljava/lang/reflect/Constructor;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public Java.Lang.Invoke.MethodHandle UnreflectConstructor (Java.Lang.Reflect.Constructor c);
[<Android.Runtime.Register("unreflectConstructor", "(Ljava/lang/reflect/Constructor;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
member this.UnreflectConstructor : Java.Lang.Reflect.Constructor -> Java.Lang.Invoke.MethodHandle

Parameters

c
Constructor

the reflected constructor

Returns

a method handle which can invoke the reflected constructor

Attributes

Remarks

Produces a method handle for a reflected constructor. The type of the method handle will be that of the constructor, with the return type changed to the declaring class. The method handle will perform a newInstance operation, creating a new instance of the constructor's class on the arguments passed to the method handle.

If the constructor's accessible flag is not set, access checking is performed immediately on behalf of the lookup class.

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

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

Java documentation for java.lang.invoke.MethodHandles.Lookup.unreflectConstructor(java.lang.reflect.Constructor<?>).

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