Field Class

Definition

A Field provides information about, and dynamic access to, a single field of a class or an interface.

[Android.Runtime.Register("java/lang/reflect/Field", DoNotGenerateAcw=true)]
public sealed class Field : Java.Lang.Reflect.AccessibleObject, IDisposable, Java.Lang.Reflect.IMember
[<Android.Runtime.Register("java/lang/reflect/Field", DoNotGenerateAcw=true)>]
type Field = class
    inherit AccessibleObject
    interface IMember
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Attributes
Implements

Remarks

A Field provides information about, and dynamic access to, a single field of a class or an interface. The reflected field may be a class (static) field or an instance field.

A Field permits widening conversions to occur during a get or set access operation, but throws an IllegalArgumentException if a narrowing conversion would occur.

Java documentation for 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.

Properties

Name Description
Accessible

Get the value of the accessible flag for this object. -or- Set the accessible flag for this object to the indicated boolean value.

(Inherited from AccessibleObject)
Class

Returns the runtime class of this Object.

(Inherited from Object)
DeclaringClass

Returns the Class object representing the class or interface that declares the field represented by this Field object.

GenericType

Returns a Type object that represents the declared type for the field represented by this Field object.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsEnumConstant

Returns true if this field represents an element of an enumerated type; returns false otherwise.

IsSynthetic

Returns true if this field is a synthetic field; returns false otherwise.

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniManagedPeerState (Inherited from JavaObject)
JniPeerMembers
Modifiers

Returns the Java language modifiers for the field represented by this Field object, as an integer.

Name

Returns the name of the field represented by this Field object.

PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from AccessibleObject)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from AccessibleObject)
Type

Returns a Class object that identifies the declared type for the field represented by this Field object.

Methods

Name Description
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Construct(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
DisposeUnlessReferenced() (Inherited from JavaObject)
Equals(Object) (Inherited from JavaObject)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Get(Object)

Returns the value of the field represented by this Field, on the specified object.

GetAnnotation(Class)

Added in 1.

GetAnnotations()

Returns annotations that are present on this object.

(Inherited from AccessibleObject)
GetAnnotationsByType(Class)

Returns annotations of the specified type that are associated with this object.

(Inherited from AccessibleObject)
GetBoolean(Object)

Gets the value of a static or instance boolean field.

GetByte(Object)

Gets the value of a static or instance byte field.

GetChar(Object)

Gets the value of a static or instance field of type char or of another primitive type convertible to type char via a widening conversion.

GetDeclaredAnnotation(Class)

Returns this object's annotation for the specified type if the annotation is directly present; otherwise, returns null.

(Inherited from AccessibleObject)
GetDeclaredAnnotations()

Returns annotations that are directly present on this object.

(Inherited from AccessibleObject)
GetDeclaredAnnotationsByType(Class)

Returns annotations of the specified type that are directly present or indirectly present on this object.

(Inherited from AccessibleObject)
GetDouble(Object)

Gets the value of a static or instance field of type double or of another primitive type convertible to type double via a widening conversion.

GetFloat(Object)

Gets the value of a static or instance field of type float or of another primitive type convertible to type float via a widening conversion.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInt(Object)

Gets the value of a static or instance field of type int or of another primitive type convertible to type int via a widening conversion.

GetLong(Object)

Gets the value of a static or instance field of type long or of another primitive type convertible to type long via a widening conversion.

GetShort(Object)

Gets the value of a static or instance field of type short or of another primitive type convertible to type short via a widening conversion.

IsAnnotationPresent(Class)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Set(Object, Object)

Sets the field represented by this Field object on the specified object argument to the specified new value.

SetBoolean(Object, Boolean)

Sets the value of a field as a boolean on the specified object.

SetByte(Object, SByte)

Sets the value of a field as a byte on the specified object.

SetChar(Object, Char)

Sets the value of a field as a char on the specified object.

SetDouble(Object, Double)

Sets the value of a field as a double on the specified object.

SetFloat(Object, Single)

Sets the value of a field as a float on the specified object.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetInt(Object, Int32)

Sets the value of a field as an int on the specified object.

SetLong(Object, Int64)

Sets the value of a field as a long on the specified object.

SetPeerReference(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
SetShort(Object, Int16)

Sets the value of a field as a short on the specified object.

ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToGenericString()

Returns a string describing this Field, including its generic type.

ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed() (Inherited from JavaObject)
IJavaPeerable.Finalized() (Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock (Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from JavaObject)
IJavaPeerable.UnregisterFromRuntime()

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to