MethodHandles.Lookup.UnreflectVarHandle(Field) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Produces a VarHandle giving access to a reflected field f
of type T
declared in a class of type R
.
[Android.Runtime.Register("unreflectVarHandle", "(Ljava/lang/reflect/Field;)Ljava/lang/invoke/VarHandle;", "", ApiSince=33)]
public Java.Lang.Invoke.VarHandle UnreflectVarHandle (Java.Lang.Reflect.Field f);
[<Android.Runtime.Register("unreflectVarHandle", "(Ljava/lang/reflect/Field;)Ljava/lang/invoke/VarHandle;", "", ApiSince=33)>]
member this.UnreflectVarHandle : Java.Lang.Reflect.Field -> Java.Lang.Invoke.VarHandle
Parameters
- f
- Field
the reflected field, with a field of type T
, and
a declaring class of type R
Returns
a VarHandle giving access to non-static fields or a static field
- Attributes
Remarks
Produces a VarHandle giving access to a reflected field f
of type T
declared in a class of type R
. The VarHandle's variable type is T
. If the field is non-static the VarHandle has one coordinate type, R
. Otherwise, the field is static, and the VarHandle has no coordinate types.
Access checking is performed immediately on behalf of the lookup class, regardless of the value of the field's accessible
flag.
If the field is static, and if the returned VarHandle is operated on, the field's declaring class will be initialized, if it has not already been initialized.
Certain access modes of the returned VarHandle are unsupported under the following conditions: <ul> <li>if the field is declared final
, then the write, atomic update, numeric atomic update, and bitwise atomic update access modes are unsupported. <li>if the field type is anything other than byte
, short
, char
, int
, long
, float
, or double
then numeric atomic update access modes are unsupported. <li>if the field type is anything other than boolean
, byte
, short
, char
, int
or long
then bitwise atomic update access modes are unsupported. </ul>
If the field is declared volatile
then the returned VarHandle will override access to the field (effectively ignore the volatile
declaration) in accordance to its specified access modes.
If the field type is float
or double
then numeric and atomic update access modes compare values using their bitwise representation (see Float#floatToRawIntBits
and Double#doubleToRawLongBits
, respectively).
Added in 9.
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.