Class Class<T>
- java.lang.Object
-
- java.lang.Class<T>
-
- All Implemented Interfaces:
Serializable,AnnotatedElement,GenericDeclaration,Type
public final class Class<T> extends Object implements Serializable, AnnotatedElement, GenericDeclaration, Type
The in-memory representation of a Java class. This representation serves as the starting point for querying class-related information, a process usually called "reflection". There are basically three types ofClassinstances: those representing real classes and interfaces, those representing primitive types, and those representing array classes.Class instances representing object types (classes or interfaces)
These represent an ordinary class or interface as found in the class hierarchy. The name associated with these
Classinstances is simply the fully qualified class name of the class or interface that it represents. In addition to this human-readable name, each class is also associated by a so-called descriptor, which is the letter "L", followed by the class name and a semicolon (";"). The descriptor is what the runtime system uses internally for identifying the class (for example in a DEX file).Classes representing primitive types
These represent the standard Java primitive types and hence share their names (for example "int" for the
intprimitive type). Although it is not possible to create new instances based on theseClassinstances, they are still useful for providing reflection information, and as the component type of array classes. There is oneClassinstance for each primitive type, and their descriptors are:Brepresenting thebyteprimitive typeSrepresenting theshortprimitive typeIrepresenting theintprimitive typeJrepresenting thelongprimitive typeFrepresenting thefloatprimitive typeDrepresenting thedoubleprimitive typeCrepresenting thecharprimitive typeZrepresenting thebooleanprimitive typeVrepresenting void function return values
Classes representing array classes
These represent the classes of Java arrays. There is one such
Classinstance per combination of array leaf component type and arity (number of dimensions). In this case, the name associated with theClassconsists of one or more left square brackets (one per dimension in the array) followed by the descriptor of the class representing the leaf component type, which can be either an object type or a primitive type. The descriptor of aClassrepresenting an array type is the same as its name. Examples of array class descriptors are:[Irepresenting theint[]type[Ljava/lang/String;representing theString[]type[[[Crepresenting thechar[][][]type (three dimensions!)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <U> Class<? extends U>asSubclass(Class<U> c)Casts thisClassto represent a subclass of the given class.Tcast(Object obj)Casts the given object to the type represented by thisClass.booleandesiredAssertionStatus()Returns the assertion status for the class represented by thisClass.static Class<?>forName(String className)Returns aClassobject which represents the class with the given name.static Class<?>forName(String className, boolean shouldInitialize, ClassLoader classLoader)Returns aClassobject which represents the class with the given name.<A extends Annotation>
AgetAnnotation(Class<A> annotationType)Returns, for this element, the annotation with the specified type, ornullif no annotation with the specified type is present (including inherited annotations).Annotation[]getAnnotations()Returns an array containing all the annotations of this class.StringgetCanonicalName()Returns the canonical name of this class.Class<?>[]getClasses()Returns an array containingClassobjects for all public classes, interfaces, enums and annotations that are members of this class and its superclasses.ClassLoadergetClassLoader()Returns the class loader which was used to load the class represented by thisClass.Class<?>getComponentType()Returns aClassobject which represents the component type if this class represents an array type.Constructor<T>getConstructor(Class<?>... parameterTypes)Returns aConstructorobject which represents the public constructor matching the given parameter types.Constructor<?>[]getConstructors()Returns an array containingConstructorobjects for all public constructors for thisClass.Annotation[]getDeclaredAnnotations()Returns the annotations that are directly defined on the class represented by thisClass.Class<?>[]getDeclaredClasses()Returns an array containingClassobjects for all classes, interfaces, enums and annotations that are members of this class.Constructor<T>getDeclaredConstructor(Class<?>... parameterTypes)Returns aConstructorobject which represents the constructor matching the specified parameter types that is declared by the class represented by thisClass.Constructor<?>[]getDeclaredConstructors()Returns an array containingConstructorobjects for all constructors declared in the class represented by thisClass.FieldgetDeclaredField(String name)Returns aFieldobject for the field with the given name which is declared in the class represented by thisClass.Field[]getDeclaredFields()Returns an array containingFieldobjects for all fields declared in the class represented by thisClass.Field[]getDeclaredFieldsUnchecked(boolean publicOnly)Populates a list of fields without performing any security or type resolution checks first.MethodgetDeclaredMethod(String name, Class<?>... parameterTypes)Returns aMethodobject which represents the method matching the specified name and parameter types that is declared by the class represented by thisClass.Method[]getDeclaredMethods()Returns an array containingMethodobjects for all methods declared in the class represented by thisClass.Method[]getDeclaredMethodsUnchecked(boolean publicOnly)Populates a list of methods without performing any security or type resolution checks first.Class<?>getDeclaringClass()Returns the class that this class is a member of, ornullif this class is a top-level class, a primitive, an array, or defined within a method or constructor.DexgetDex()Returns the dex file from which this class was loaded.intgetDexAnnotationDirectoryOffset()The annotation directory offset of this class in its own Dex, or 0 if it is unknown.StringgetDexCacheString(Dex dex, int dexStringIndex)Returns a string from the dex cache, computing the string from the dex file if necessary.Class<?>getDexCacheType(Dex dex, int dexTypeIndex)Returns a resolved type from the dex cache, computing the type from the dex file if necessary.intgetDexClassDefIndex()The class def of this class in its own Dex, or -1 if there is no class def.intgetDexTypeIndex()The type index of this class in its own Dex, or -1 if it is unknown.Class<?>getEnclosingClass()Returns the class enclosing this class.Constructor<?>getEnclosingConstructor()Returns the enclosingConstructorof thisClass, if it is an anonymous or local/automatic class; otherwisenull.MethodgetEnclosingMethod()Returns the enclosingMethodof thisClass, if it is an anonymous or local/automatic class; otherwisenull.T[]getEnumConstants()Returns theenumconstants associated with thisClass.FieldgetField(String name)Returns aFieldobject which represents the public field with the given name.Field[]getFields()Returns an array containingFieldobjects for all public fields for the class C represented by thisClass.Type[]getGenericInterfaces()Returns theTypes of the interfaces that thisClassdirectly implements.TypegetGenericSuperclass()Returns theTypethat represents the superclass of thisclass.Class<?>[]getInterfaces()Returns an array ofClassobjects that match the interfaces in theimplementsdeclaration of the class represented by thisClass.MethodgetMethod(String name, Class<?>... parameterTypes)Returns aMethodobject which represents the public method with the specified name and parameter types.Method[]getMethods()Returns an array containingMethodobjects for all public methods for the class C represented by thisClass.intgetModifiers()Returns an integer that represents the modifiers of the class represented by thisClass.StringgetName()Returns the name of the class represented by thisClass.PackagegetPackage()Returns thePackageof which the class represented by thisClassis a member.StringgetPackageName$()Returns the package name of this class.ProtectionDomaingetProtectionDomain()Returnsnull.URLgetResource(String resourceName)Returns the URL of the given resource, ornullif the resource is not found.InputStreamgetResourceAsStream(String resourceName)Returns a read-only stream for the contents of the given resource, ornullif the resource is not found.Object[]getSigners()Returnsnull.StringgetSimpleName()Returns the simple name of the class represented by thisClassas defined in the source code.Class<? super T>getSuperclass()Returns theClassobject which represents the superclass of the class represented by thisClass.TypeVariable<Class<T>>[]getTypeParameters()Returns an array containingTypeVariableobjects for type variables declared by the generic class represented by thisClass.booleanisAnnotation()Tests whether thisClassrepresents an annotation class.booleanisAnnotationPresent(Class<? extends Annotation> annotationType)Indicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).booleanisAnonymousClass()Tests whether the class represented by thisClassis anonymous.booleanisArray()Tests whether the class represented by thisClassis an array class.booleanisAssignableFrom(Class<?> c)Cancbe assigned to this class?booleanisEnum()Tests whether the class represented by thisClassis anenum.booleanisFinalizable()Indicates whether thisClassor its parents override finalize.booleanisInstance(Object object)Tests whether the given object can be cast to the class represented by thisClass.booleanisInterface()Tests whether thisClassrepresents an interface.booleanisLocalClass()Tests whether the class represented by thisClassis defined locally.booleanisMemberClass()Tests whether the class represented by thisClassis a member class.booleanisPrimitive()Tests whether thisClassrepresents a primitive type.booleanisProxy()Is this a runtime created proxy class?booleanisSynthetic()Tests whether thisClassrepresents a synthetic type.TnewInstance()Returns a new instance of the class represented by thisClass, created by invoking the default (that is, zero-argument) constructor.StringtoString()Returns a string containing a concise, human-readable description of this object.
-
-
-
Method Detail
-
forName
public static Class<?> forName(String className) throws ClassNotFoundException
Returns aClassobject which represents the class with the given name. The name should be the name of a non-primitive class, as described in theclass definition. Primitive types can not be found using this method; useint.classorInteger.TYPEinstead.If the class has not yet been loaded, it is loaded and initialized first. This is done through either the class loader of the calling class or one of its parent class loaders. It is possible that a static initializer is run as a result of this call.
- Throws:
ClassNotFoundException- if the requested class cannot be found.LinkageError- if an error occurs during linkageExceptionInInitializerError- if an exception occurs during static initialization of a class.
-
forName
public static Class<?> forName(String className, boolean shouldInitialize, ClassLoader classLoader) throws ClassNotFoundException
Returns aClassobject which represents the class with the given name. The name should be the name of a non-primitive class, as described in theclass definition. Primitive types can not be found using this method; useint.classorInteger.TYPEinstead.If the class has not yet been loaded, it is loaded first, using the given class loader. If the class has not yet been initialized and
shouldInitializeis true, the class will be initialized.If the provided
classLoaderisnull, the bootstrap class loader will be used to load the class.- Throws:
ClassNotFoundException- if the requested class cannot be found.LinkageError- if an error occurs during linkageExceptionInInitializerError- if an exception occurs during static initialization of a class.
-
getClasses
public Class<?>[] getClasses()
Returns an array containingClassobjects for all public classes, interfaces, enums and annotations that are members of this class and its superclasses. This does not include classes of implemented interfaces. If there are no such class members or if this object represents a primitive type then an array of length 0 is returned.
-
getAnnotation
public <A extends Annotation> A getAnnotation(Class<A> annotationType)
Description copied from interface:AnnotatedElementReturns, for this element, the annotation with the specified type, ornullif no annotation with the specified type is present (including inherited annotations).- Specified by:
getAnnotationin interfaceAnnotatedElement- Parameters:
annotationType- the type of the annotation to search for- Returns:
- the annotation with the specified type or
null
-
getAnnotations
public Annotation[] getAnnotations()
Returns an array containing all the annotations of this class. If there are no annotations then an empty array is returned.- Specified by:
getAnnotationsin interfaceAnnotatedElement- Returns:
- an array of all annotations for this element
- See Also:
getDeclaredAnnotations()
-
getCanonicalName
public String getCanonicalName()
Returns the canonical name of this class. If this class does not have a canonical name as defined in the Java Language Specification, then the method returnsnull.
-
getClassLoader
public ClassLoader getClassLoader()
Returns the class loader which was used to load the class represented by thisClass. Implementations are free to returnnullfor classes that were loaded by the bootstrap class loader. The Android reference implementation, though, always returns a reference to an actual class loader.
-
getComponentType
public Class<?> getComponentType()
Returns aClassobject which represents the component type if this class represents an array type. Returnsnullif this class does not represent an array type. The component type of an array type is the type of the elements of the array.
-
getDex
public Dex getDex()
Returns the dex file from which this class was loaded.
-
getDexCacheString
public String getDexCacheString(Dex dex, int dexStringIndex)
Returns a string from the dex cache, computing the string from the dex file if necessary.
-
getDexCacheType
public Class<?> getDexCacheType(Dex dex, int dexTypeIndex)
Returns a resolved type from the dex cache, computing the type from the dex file if necessary.
-
getConstructor
public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException
Returns aConstructorobject which represents the public constructor matching the given parameter types.(Class[]) nullis equivalent to the empty array.- Throws:
NoSuchMethodException- if the constructor cannot be found.- See Also:
getDeclaredConstructor(Class[])
-
getDeclaredConstructor
public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes) throws NoSuchMethodException
Returns aConstructorobject which represents the constructor matching the specified parameter types that is declared by the class represented by thisClass.(Class[]) nullis equivalent to the empty array.- Throws:
NoSuchMethodException- if the requested constructor cannot be found.- See Also:
getConstructor(Class[])
-
getConstructors
public Constructor<?>[] getConstructors()
Returns an array containingConstructorobjects for all public constructors for thisClass. If there are no public constructors or if thisClassrepresents an array class, a primitive type or void then an empty array is returned.- See Also:
getDeclaredConstructors()
-
getDeclaredConstructors
public Constructor<?>[] getDeclaredConstructors()
Returns an array containingConstructorobjects for all constructors declared in the class represented by thisClass. If there are no constructors or if thisClassrepresents an array class, a primitive type or void then an empty array is returned.- See Also:
getConstructors()
-
getDeclaredMethod
public Method getDeclaredMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException
Returns aMethodobject which represents the method matching the specified name and parameter types that is declared by the class represented by thisClass.- Parameters:
name- the requested method's name.parameterTypes- the parameter types of the requested method.(Class[]) nullis equivalent to the empty array.- Returns:
- the method described by
nameandparameterTypes. - Throws:
NoSuchMethodException- if the requested method cannot be found.NullPointerException- ifnameisnull.- See Also:
getMethod(String, Class[])
-
getMethod
public Method getMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException
Returns aMethodobject which represents the public method with the specified name and parameter types.(Class[]) nullis equivalent to the empty array. This method first searches the class C represented by thisClass, then the superclasses of C and finally the interfaces implemented by C and finally the superclasses of C for a method with matching name.- Throws:
NoSuchMethodException- if the method cannot be found.- See Also:
getDeclaredMethod(String, Class[])
-
getDeclaredMethods
public Method[] getDeclaredMethods()
Returns an array containingMethodobjects for all methods declared in the class represented by thisClass. If there are no methods or if thisClassrepresents an array class, a primitive type or void then an empty array is returned.- See Also:
getMethods()
-
getDeclaredMethodsUnchecked
public Method[] getDeclaredMethodsUnchecked(boolean publicOnly)
Populates a list of methods without performing any security or type resolution checks first. If no methods exist, the list is not modified.- Parameters:
publicOnly- Whether to return only public methods.methods- A list to populate with declared methods.
-
getMethods
public Method[] getMethods()
Returns an array containingMethodobjects for all public methods for the class C represented by thisClass. Methods may be declared in C, the interfaces it implements or in the superclasses of C. The elements in the returned array are in no particular order.If there are no public methods or if this
Classrepresents a primitive type orvoidthen an empty array is returned.- See Also:
getDeclaredMethods()
-
getDeclaredAnnotations
public Annotation[] getDeclaredAnnotations()
Returns the annotations that are directly defined on the class represented by thisClass. Annotations that are inherited are not included in the result. If there are no annotations at all, an empty array is returned.- Specified by:
getDeclaredAnnotationsin interfaceAnnotatedElement- Returns:
- an array of annotations declared for this element
- See Also:
getAnnotations()
-
getDeclaredClasses
public Class<?>[] getDeclaredClasses()
Returns an array containingClassobjects for all classes, interfaces, enums and annotations that are members of this class.
-
getDeclaredField
public Field getDeclaredField(String name) throws NoSuchFieldException
Returns aFieldobject for the field with the given name which is declared in the class represented by thisClass.- Throws:
NoSuchFieldException- if the requested field can not be found.- See Also:
getField(String)
-
getDeclaredFields
public Field[] getDeclaredFields()
Returns an array containingFieldobjects for all fields declared in the class represented by thisClass. If there are no fields or if thisClassrepresents an array class, a primitive type or void then an empty array is returned.- See Also:
getFields()
-
getDeclaredFieldsUnchecked
public Field[] getDeclaredFieldsUnchecked(boolean publicOnly)
Populates a list of fields without performing any security or type resolution checks first. If no fields exist, the list is not modified.- Parameters:
publicOnly- Whether to return only public fields.fields- A list to populate with declared fields.
-
getDeclaringClass
public Class<?> getDeclaringClass()
Returns the class that this class is a member of, ornullif this class is a top-level class, a primitive, an array, or defined within a method or constructor.
-
getEnclosingClass
public Class<?> getEnclosingClass()
Returns the class enclosing this class. For most classes this is the same as thedeclaring class. For classes defined within a method or constructor (typically anonymous inner classes), this is the declaring class of that member.
-
getEnclosingConstructor
public Constructor<?> getEnclosingConstructor()
Returns the enclosingConstructorof thisClass, if it is an anonymous or local/automatic class; otherwisenull.
-
getEnclosingMethod
public Method getEnclosingMethod()
Returns the enclosingMethodof thisClass, if it is an anonymous or local/automatic class; otherwisenull.
-
getEnumConstants
public T[] getEnumConstants()
Returns theenumconstants associated with thisClass. Returnsnullif thisClassdoes not represent anenumtype.
-
getField
public Field getField(String name) throws NoSuchFieldException
Returns aFieldobject which represents the public field with the given name. This method first searches the class C represented by thisClass, then recursively callsgetFieldon the interfaces directly implemented by C (in the order they are declared) and finally recursively callsgetFieldon the superclass of C.- Throws:
NoSuchFieldException- if the field cannot be found.NullPointerException- if name is null.- See Also:
getDeclaredField(String)
-
getFields
public Field[] getFields()
Returns an array containingFieldobjects for all public fields for the class C represented by thisClass. Fields may be declared in C, the interfaces it implements or in the superclasses of C. The elements in the returned array are in no particular order.If there are no public fields or if this class represents an array class, a primitive type or
voidthen an empty array is returned.- See Also:
getDeclaredFields()
-
getGenericInterfaces
public Type[] getGenericInterfaces()
Returns theTypes of the interfaces that thisClassdirectly implements. If theClassrepresents a primitive type orvoidthen an empty array is returned.
-
getGenericSuperclass
public Type getGenericSuperclass()
Returns theTypethat represents the superclass of thisclass.
-
getInterfaces
public Class<?>[] getInterfaces()
Returns an array ofClassobjects that match the interfaces in theimplementsdeclaration of the class represented by thisClass. The order of the elements in the array is identical to the order in the original class declaration. If the class does not implement any interfaces, an empty array is returned.This method only returns directly-implemented interfaces, and does not include interfaces implemented by superclasses or superinterfaces of any implemented interfaces.
-
getModifiers
public int getModifiers()
Returns an integer that represents the modifiers of the class represented by thisClass. The returned value is a combination of bits defined by constants in theModifierclass.
-
getName
public String getName()
Returns the name of the class represented by thisClass. For a description of the format which is used, see the class definition ofClass.
-
getSimpleName
public String getSimpleName()
Returns the simple name of the class represented by thisClassas defined in the source code. If there is no name (that is, the class is anonymous) then an empty string is returned. If the receiver is an array then the name of the underlying type with square braces appended (for example"Integer[]") is returned.- Returns:
- the simple name of the class represented by this
Class.
-
getProtectionDomain
public ProtectionDomain getProtectionDomain()
Returnsnull.
-
getResource
public URL getResource(String resourceName)
Returns the URL of the given resource, ornullif the resource is not found. The mapping between the resource name and the URL is managed by the class' class loader.- See Also:
ClassLoader
-
getResourceAsStream
public InputStream getResourceAsStream(String resourceName)
Returns a read-only stream for the contents of the given resource, ornullif the resource is not found. The mapping between the resource name and the stream is managed by the class' class loader.- See Also:
ClassLoader
-
getSigners
public Object[] getSigners()
Returnsnull. (On Android, aClassLoadercan load classes from multiple dex files. All classes from any given dex file will have the same signers, but different dex files may have different signers. This does not fit well with the originalClassLoader-based model ofgetSigners.)
-
getSuperclass
public Class<? super T> getSuperclass()
Returns theClassobject which represents the superclass of the class represented by thisClass. If thisClassrepresents theObjectclass, a primitive type, an interface or void then the method returnsnull. If thisClassrepresents an array class then theObjectclass is returned.
-
getTypeParameters
public TypeVariable<Class<T>>[] getTypeParameters()
Returns an array containingTypeVariableobjects for type variables declared by the generic class represented by thisClass. Returns an empty array if the class is not generic.- Specified by:
getTypeParametersin interfaceGenericDeclaration- Returns:
- the declared type parameters in declaration order
-
isAnnotation
public boolean isAnnotation()
Tests whether thisClassrepresents an annotation class.
-
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
Description copied from interface:AnnotatedElementIndicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).- Specified by:
isAnnotationPresentin interfaceAnnotatedElement- Parameters:
annotationType- the type of the annotation to search for- Returns:
trueif the annotation exists,falseotherwise
-
isAnonymousClass
public boolean isAnonymousClass()
Tests whether the class represented by thisClassis anonymous.
-
isArray
public boolean isArray()
Tests whether the class represented by thisClassis an array class.
-
isProxy
public boolean isProxy()
Is this a runtime created proxy class?
-
isAssignableFrom
public boolean isAssignableFrom(Class<?> c)
Cancbe assigned to this class? For example, String can be assigned to Object (by an upcast), however, an Object cannot be assigned to a String as a potentially exception throwing downcast would be necessary. Similarly for interfaces, a class that implements (or an interface that extends) another can be assigned to its parent, but not vice-versa. All Classes may assign to themselves. Classes for primitive types may not assign to each other.- Parameters:
c- the class to check.- Returns:
trueifccan be assigned to the class represented by thisClass;falseotherwise.- Throws:
NullPointerException- ifcisnull.
-
isEnum
public boolean isEnum()
Tests whether the class represented by thisClassis anenum.
-
isInstance
public boolean isInstance(Object object)
Tests whether the given object can be cast to the class represented by thisClass. This is the runtime version of theinstanceofoperator.- Returns:
trueifobjectcan be cast to the type represented by thisClass;falseifobjectisnullor cannot be cast.
-
isInterface
public boolean isInterface()
Tests whether thisClassrepresents an interface.
-
isLocalClass
public boolean isLocalClass()
Tests whether the class represented by thisClassis defined locally.
-
isMemberClass
public boolean isMemberClass()
Tests whether the class represented by thisClassis a member class.
-
isPrimitive
public boolean isPrimitive()
Tests whether thisClassrepresents a primitive type.
-
isSynthetic
public boolean isSynthetic()
Tests whether thisClassrepresents a synthetic type.
-
isFinalizable
public boolean isFinalizable()
Indicates whether thisClassor its parents override finalize.
-
newInstance
public T newInstance() throws InstantiationException, IllegalAccessException
Returns a new instance of the class represented by thisClass, created by invoking the default (that is, zero-argument) constructor. If there is no such constructor, or if the creation fails (either because of a lack of available memory or because an exception is thrown by the constructor), anInstantiationExceptionis thrown. If the default constructor exists but is not accessible from the context where this method is invoked, anIllegalAccessExceptionis thrown.- Throws:
IllegalAccessException- if the default constructor is not visible.InstantiationException- if the instance cannot be created.
-
toString
public String toString()
Description copied from class:ObjectReturns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toStringmethod if you intend implementing your owntoStringmethod.
-
getPackage
public Package getPackage()
Returns thePackageof which the class represented by thisClassis a member. Returnsnullif noPackageobject was created by the class loader of the class.
-
getPackageName$
public String getPackageName$()
Returns the package name of this class. This returnsnullfor classes in the default package.
-
desiredAssertionStatus
public boolean desiredAssertionStatus()
Returns the assertion status for the class represented by thisClass. Assertion is enabled / disabled based on the class loader, package or class default at runtime.
-
asSubclass
public <U> Class<? extends U> asSubclass(Class<U> c)
Casts thisClassto represent a subclass of the given class. If successful, thisClassis returned; otherwise aClassCastExceptionis thrown.- Throws:
ClassCastException- if thisClasscannot be cast to the given type.
-
cast
public T cast(Object obj)
Casts the given object to the type represented by thisClass. If the object isnullthen the result is alsonull.- Throws:
ClassCastException- if the object cannot be cast to the given type.
-
getDexClassDefIndex
public int getDexClassDefIndex()
The class def of this class in its own Dex, or -1 if there is no class def.
-
getDexTypeIndex
public int getDexTypeIndex()
The type index of this class in its own Dex, or -1 if it is unknown. If a class is referenced by multiple Dex files, it will have a different type index in each. Dex files support 65534 type indices, with 65535 representing no index.
-
getDexAnnotationDirectoryOffset
public int getDexAnnotationDirectoryOffset()
The annotation directory offset of this class in its own Dex, or 0 if it is unknown. TODO: 0 is a sentinel that means 'no annotations directory'; this should be -1 if unknown
-
-