Sdílet prostřednictvím


MethodHandles.Lookup.FindStaticSetter(Class, String, Class) Method

Definition

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

[Android.Runtime.Register("findStaticSetter", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public Java.Lang.Invoke.MethodHandle FindStaticSetter (Java.Lang.Class refc, string name, Java.Lang.Class type);
[<Android.Runtime.Register("findStaticSetter", "(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
member this.FindStaticSetter : Java.Lang.Class * string * Java.Lang.Class -> Java.Lang.Invoke.MethodHandle

Parameters

refc
Class

the class or interface from which the method is accessed

name
String

the field's name

type
Class

the field's type

Returns

a method handle which can store values into the field

Attributes

Remarks

Produces a method handle giving write access to a static field. The type of the method handle will have a void return type. The method handle will take a single argument, of the field's value type, the value to be stored. Access checking is performed immediately on behalf of the lookup class.

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.findStaticSetter(java.lang.Class<?>, java.lang.String, java.lang.Class<?>).

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