Class Class Class

Definition

The in-memory representation of a Java class.

[Android.Runtime.Register("java/lang/Class", ApiSince=1, DoNotGenerateAcw=true)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public sealed class Class : Java.Lang.Object, IDisposable, Java.IO.ISerializable, Java.Lang.Reflect.IGenericDeclaration, Java.Lang.Reflect.IType
type Class = class
    inherit Object
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IGenericDeclaration
    interface IAnnotatedElement
    interface IType
Inheritance
Attributes
Implements

Remarks

Android platform documentation

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.

Fields

CharSequence CharSequence
Object Object
String String

Properties

CanonicalName CanonicalName

Returns the canonical name of this class.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
ClassLoader ClassLoader

Returns the class loader which was used to load the class represented by this Class.

ComponentType ComponentType

Returns a Class object which represents the component type if this class represents an array type.

DeclaringClass DeclaringClass

Returns the class that this class is a member of, or null if this class is a top-level class, a primitive, an array, or defined within a method or constructor.

EnclosingClass EnclosingClass

Returns the class enclosing this class.

EnclosingConstructor EnclosingConstructor

Returns the enclosing Constructor of this Class, if it is an anonymous or local/automatic class; otherwise null.

EnclosingMethod EnclosingMethod

Returns the enclosing Method of this Class, if it is an anonymous or local/automatic class; otherwise null.

GenericSuperclass GenericSuperclass

Returns the Type that represents the superclass of this class.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
IsAnnotation IsAnnotation

Tests whether this Class represents an annotation class.

IsAnonymousClass IsAnonymousClass

Tests whether the class represented by this Class is anonymous.

IsArray IsArray

Tests whether the class represented by this Class is an array class.

IsEnum IsEnum

Tests whether the class represented by this Class is an enum.

IsInterface IsInterface

Tests whether this Class represents an interface.

IsLocalClass IsLocalClass

Tests whether the class represented by this Class is defined locally.

IsMemberClass IsMemberClass

Tests whether the class represented by this Class is a member class.

IsPrimitive IsPrimitive

Tests whether this Class represents a primitive type.

IsSynthetic IsSynthetic

Tests whether this Class represents a synthetic type.

JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
Modifiers Modifiers

Returns an integer that represents the modifiers of the class represented by this Class.

Name Name

Returns the name of the class represented by this Class.

Package Package

Returns the Package of which the class represented by this Class is a member.

PeerReference PeerReference Inherited from Object
ProtectionDomain ProtectionDomain

Returns null.

SimpleName SimpleName

Returns the simple name of the class represented by this Class as defined in the source code.

Superclass Superclass

Returns the Class object which represents the superclass of the class represented by this Class.

ThresholdClass ThresholdClass

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

(Inherited from Object)
ThresholdType ThresholdType

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

(Inherited from Object)
TypeName TypeName

Methods

AsSubclass(Class) AsSubclass(Class)
Cast(Object) Cast(Object)

Casts the given object to the type represented by this Class.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
DesiredAssertionStatus() DesiredAssertionStatus()

Returns the assertion status for the class represented by this Class.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
ForName(String) ForName(String)

Returns a Class object which represents the class with the given name.

ForName(String, Boolean, ClassLoader) ForName(String, Boolean, ClassLoader)

Returns a Class object which represents the class with the given name.

FromType(Type) FromType(Type)
GetAnnotation(Class) GetAnnotation(Class)
GetAnnotations() GetAnnotations()

Returns an array containing all the annotations of this class.

GetAnnotationsByType(Class) GetAnnotationsByType(Class)
GetClasses() GetClasses()

Returns an array containing Class objects for all public classes, interfaces, enums and annotations that are members of this class and its superclasses.

GetConstructor(Class[]) GetConstructor(Class[])
GetConstructors() GetConstructors()

Returns an array containing Constructor objects for all public constructors for this Class.

GetDeclaredAnnotation(Class) GetDeclaredAnnotation(Class)
GetDeclaredAnnotations() GetDeclaredAnnotations()

Returns the annotations that are directly defined on the class represented by this Class.

GetDeclaredClasses() GetDeclaredClasses()

Returns an array containing Class objects for all classes, interfaces, enums and annotations that are members of this class.

GetDeclaredConstructor(Class[]) GetDeclaredConstructor(Class[])
GetDeclaredConstructors() GetDeclaredConstructors()

Returns an array containing Constructor objects for all constructors declared in the class represented by this Class.

GetDeclaredField(String) GetDeclaredField(String)

Returns a Field object for the field with the given name which is declared in the class represented by this Class.

GetDeclaredFields() GetDeclaredFields()

Returns an array containing Field objects for all fields declared in the class represented by this Class.

GetDeclaredMethod(String, Class[]) GetDeclaredMethod(String, Class[])
GetDeclaredMethods() GetDeclaredMethods()

Returns an array containing Method objects for all methods declared in the class represented by this Class.

GetEnumConstants() GetEnumConstants()

Returns the enum constants associated with this Class.

GetField(String) GetField(String)

Returns a Field object which represents the public field with the given name.

GetFields() GetFields()

Returns an array containing Field objects for all public fields for the class C represented by this Class.

GetGenericInterfaces() GetGenericInterfaces()

Returns the ITypes of the interfaces that this Class directly implements.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetInterfaces() GetInterfaces()

Returns an array of Class objects that match the interfaces in the implements declaration of the class represented by this Class.

GetMethod(String, Class[]) GetMethod(String, Class[])
GetMethods() GetMethods()

Returns an array containing Method objects for all public methods for the class C represented by this Class.

GetResource(String) GetResource(String)

Returns the URL of the given resource, or null if the resource is not found.

GetResourceAsStream(String) GetResourceAsStream(String)

Returns a read-only stream for the contents of the given resource, or null if the resource is not found.

GetSigners() GetSigners()

Returns null.

GetTypeParameters() GetTypeParameters()

Returns an array containing TypeVariable objects for type variables declared by the generic class represented by this Class.

IsAnnotationPresent(Class) IsAnnotationPresent(Class)
IsAssignableFrom(Class) IsAssignableFrom(Class)
IsInstance(Object) IsInstance(Object)

Tests whether the given object can be cast to the class represented by this Class.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
NewInstance() NewInstance()

Returns a new instance of the class represented by this Class, created by invoking the default (that is, zero-argument) constructor.

Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() ToArray<T>() Inherited from Object
ToGenericString() ToGenericString()
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to