Language

JavaObject Class

Definition

Class Object is the root of the class hierarchy.

[Java.Interop.JniTypeSignature("java/lang/Object", GenerateJavaPeer=false)]
[System.Serializable]
public class JavaObject : IDisposable, Java.Interop.IJavaPeerable
[<Java.Interop.JniTypeSignature("java/lang/Object", GenerateJavaPeer=false)>]
[<System.Serializable>]
type JavaObject = class
    interface IJavaPeerable
    interface IDisposable
Inheritance
JavaObject
Derived
Attributes
Implements

Remarks

Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.

Java reference for java.lang.Object.

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.

Constructors

Name Description
JavaObject()

Constructs a new object.

JavaObject(JniObjectReference, JniObjectReferenceOptions)

Initializes a managed object peer through the runtime's construction policy.

Fields

Name Description
InvalidJniObjectReference

A null pointer sentinel used only with None to defer peer initialization.

Properties

Name Description
JniIdentityHashCode

Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode().

JniManagedPeerState

Gets the state flags last assigned by the runtime.

JniPeerMembers

Gets the member-access information for this managed Java peer.

PeerReference

Gets the JNI reference currently stored in the peer control block.

Methods

Name Description
Construct(JniObjectReference, JniObjectReferenceOptions)

Delegates construction of this peer to the runtime's value manager.

Dispose()

Delegates peer disposal to the runtime's value manager.

Dispose(Boolean)

Provides a derived-class cleanup hook; the base implementation does nothing.

DisposeUnlessReferenced()

Asks the value manager to dispose this peer unless its mapping retains this same managed instance.

Equals(Object)

Tests whether another managed peer refers to the same Java object.

Finalize()

Passes this peer to the runtime's finalization policy.

GetHashCode()

Returns a hash code value for the object.

SetPeerReference(JniObjectReference, JniObjectReferenceOptions)

Stores a reference value in the control block without creating a JNI reference copy.

ToString()

Returns a string representation of the object.

UnregisterFromRuntime()

Removes this managed peer from the runtime mapping without disposing its JNI reference.

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed()

Marks this peer as disposed and calls Dispose with disposing set to true.

IJavaPeerable.Finalized()

Marks this peer as disposed and calls Dispose with disposing set to false.

IJavaPeerable.JniObjectReferenceControlBlock

Gets the native control-block pointer used by this peer.

IJavaPeerable.SetJniIdentityHashCode(Int32)

Stores the identity hash code supplied by the runtime.

IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

Replaces the stored managed peer state flags.

IJavaPeerable.SetPeerReference(JniObjectReference)

Updates the peer reference and releases a disposed peer's control block when the reference is invalid.

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.

TryJavaCast<TResult>(IJavaPeerable, TResult)

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

Applies to