Freigeben über


MethodHandles.Lookup.UnreflectGetter(Field) Method

Definition

Produces a method handle giving read access to a reflected field.

[Android.Runtime.Register("unreflectGetter", "(Ljava/lang/reflect/Field;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public Java.Lang.Invoke.MethodHandle UnreflectGetter (Java.Lang.Reflect.Field f);
[<Android.Runtime.Register("unreflectGetter", "(Ljava/lang/reflect/Field;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
member this.UnreflectGetter : Java.Lang.Reflect.Field -> Java.Lang.Invoke.MethodHandle

Parameters

f
Field

the reflected field

Returns

a method handle which can load values from the reflected field

Attributes

Remarks

Produces a method handle giving read access to a reflected field. The type of the method handle will have a return type of the field's value type. If the field is static, the method handle will take no arguments. Otherwise, its single argument will be the instance containing the field. If the field's accessible flag is not set, access checking is performed immediately on behalf of the lookup class.

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

Java documentation for java.lang.invoke.MethodHandles.Lookup.unreflectGetter(java.lang.reflect.Field).

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