All Superinterfaces:
ICodeClass, ICodeItem, IDexItem

public interface IDexClass extends IDexItem, ICodeClass
This interface represents a Dex class_def_item object. All internal Dex types implement this interface, it is not limited to actual class types. Retrieved via IDexUnit.getClasses().
  • Method Details

    • getClassTypeIndex

      int getClassTypeIndex()
      Get the type index for this class object.
      Returns:
      the index
    • getSuperTypeIndex

      int getSuperTypeIndex()
      Get the type index for the superclass of this class.
      Returns:
      the superclass type index, or -1 if none (ie, java.lang.Object)
    • getSupertypeSignature

      String getSupertypeSignature(boolean effective)
      Get the superclass of that class. At least java.lang.Object.
      Returns:
      FQ-classname of the superclass
    • getInterfaceTypeIndexes

      int[] getInterfaceTypeIndexes()
      Get the type indexes of the interfaces implemented by this class.
      Returns:
      the type indexes
    • getInterfaceSignatures

      String[] getInterfaceSignatures(boolean effective)
      Get the list of interfaces implemented by this class.
      Returns:
      list of strings representing the FQ-classnames of the interfaces.
    • getAccessFlags

      int getAccessFlags()
      Get the access flags for the class.
      Returns:
      a combination of access flags defined in IDexUnit
    • getSourceStringIndex

      int getSourceStringIndex()
      Get the string index of the file name containing the original source for this class.

      Note: This is a debug/metadata field and should be used with caution.

      Returns:
      the string index, -1 if it is not set
    • getFields

      List<? extends IDexField> getFields()
      Description copied from interface: ICodeClass
      Get the list of fields that are defined in this class (super fields are not returned).
      Specified by:
      getFields in interface ICodeClass
      Returns:
      a non-null list of fields
    • getMethods

      List<? extends IDexMethod> getMethods()
      Description copied from interface: ICodeClass
      Get the list of methods that are defined in this class (super methods are not returned).
      Specified by:
      getMethods in interface ICodeClass
      Returns:
      a non-null list of methods
    • getDexFileIndex

      int getDexFileIndex()
      Retrieve the index of the dex file that defines this class or interface.
      Returns:
      an index into IDexUnit.getDexFiles() (of the owner , or -1 if unknown or not defined
    • getData

      IDexClassData getData()
      Get the class data.
      Returns:
      the class data reference, or null if there is no class data (eg, marker interface)
    • getStaticInitializers

      List<? extends IDexValue> getStaticInitializers()
      Get the static initializers of the class.
      Returns:
      the list of initial values for static fields
    • getAnnotationsDirectory

      IDexAnnotationsDirectory getAnnotationsDirectory()
      Get the annotations directory of the class. The directory contains annotations for the class, methods, fields and methods' parameters.
      Returns:
      the annotations directory
    • setName

      boolean setName(String name)
      Rename this class or type. This method does not notify changes on success: it is up to the user to issue a J.UnitChange notification.

      This method is for convenience only: users can always use the associated unit's RENAME action (through the executeAction method) to rename an item generically.

      Parameters:
      name - the new name
      Returns:
      success indicator
    • isMemberClass

      boolean isMemberClass()
      This higher-level method indicates if this class is a member class (Dalvik terminology equivalent of Java's "nested" class), that is, a class defined within another class or method. A member class can be static (nested inside a class), inner (non-static, nested inside a class), local (non-static, nested inside a method), or anonymous (always non-static, within a class or method). (Note that lambdas are not considered here: native lambdas are invoked using specific bytecode; desugared lambdas are implemented with standard member classes.)

      This method does not necessarily reflect the underlying dex class data, in particular, the annotations metadata. If a publicized inner class is deemed improper, this method will return false regardless of what metadata say.

      Returns:
      true if the class looks like a valid member class
    • isAnonymousClass

      boolean isAnonymousClass()
      This higher-level method indicates if this class was determined as an actual member (nested) class, specifically an anonymous member class.

      It may not reflect underlying metadata information (such as class annotations, etc.).

      Returns:
    • isNonStaticMemberClass

      boolean isNonStaticMemberClass()
      This higher-level method indicates if this class was determined as an actual member (nested) class, specifically a non-static member class, i.e. one of inner class, local class, or anonymous class.

      It may not reflect underlying metadata information (such as class annotations, etc.).

      Returns:
    • isStaticMemberClass

      boolean isStaticMemberClass()
      This higher-level method indicates if this class was determined as an actual member (nested) class, specifically a static member class.

      It may not reflect underlying metadata information (such as class annotations, etc.).

      Returns:
    • getMethod

      IDexMethod getMethod(boolean effective, String name, String... parameterTypes)
      Retrieve a method defined in this class.
      Parameters:
      effective - the provided name and type signatures are effective names, as opposed to original names
      name - method name
      parameterTypes - method parameter types (jvm notation)
      Returns:
      a method or null if not found
    • getField

      IDexField getField(boolean effective, String name, String fieldtype)
      Retrieve a field defined in this class.
      Parameters:
      effective - the provided name and type are effective names, as opposed to original names
      name - field name
      fieldtype - field type (jvm notation)
      Returns:
      a field or null if not found
    • isTrueClass

      boolean isTrueClass()
      Determine if a class is a 'true' class, meaning a class which is neither an interface nor an enumeration nor an annotation.
      Returns:
    • isEnumeration

      boolean isEnumeration()
      Helper method to determine whether this type is an enumeration.
      Returns:
    • isInterface

      boolean isInterface()
      Helper method to determine whether this type is an interface.
      Returns:
    • isAnnotation

      boolean isAnnotation()
      Helper method to determine whether this type is an annotation.
      Returns:
    • isSynthetic

      boolean isSynthetic()
      Helper method to determine whether this type is marked as synthetic, that is, auto-generated by a compiler. This hint should not be trusted.
      Returns:
    • getAnnotationDefaults

      Map<String,IDexValue> getAnnotationDefaults()
      A convenience method used to retrieve the list of annotation default values, if this type is an annotation type.
      Returns:
      a map of default annotation values, possibly empty; this method returns null if this object does not represent an annotation type