Sdílet prostřednictvím


MethodHandles.Lookup.UnreflectSetter(Field) Method

Definition

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

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

Parameters

f
Field

the reflected field

Returns

a method handle which can store values into the reflected field

Attributes

Remarks

Produces a method handle giving write access to a reflected field. The type of the method handle will have a void return type. If the field is static, the method handle will take a single argument, of the field's value type, the value to be stored. Otherwise, the two arguments will be the instance containing the field, and the value to be stored. 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.unreflectSetter(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