Class DexBackedClassDef

    • Constructor Detail

      • DexBackedClassDef

        public DexBackedClassDef​(@Nonnull
                                 DexBackedDexFile dexFile,
                                 int classDefOffset,
                                 int hiddenApiRestrictionsOffset)
    • Method Detail

      • getType

        @Nonnull
        public java.lang.String getType()
        Description copied from interface: ClassDef
        Gets the class type. This will be a type descriptor per the dex file specification.
        Specified by:
        getType in interface ClassDef
        Specified by:
        getType in interface TypeReference
        Returns:
        The class type
      • getSuperclass

        @Nullable
        public java.lang.String getSuperclass()
        Description copied from interface: ClassDef
        Gets the superclass of this class. This will only be null if this is the base java.lang.Object class.
        Specified by:
        getSuperclass in interface ClassDef
        Returns:
        The superclass of this class
      • getAccessFlags

        public int getAccessFlags()
        Description copied from interface: ClassDef
        Gets the access flags for this class. This will be a combination of the AccessFlags.* flags that are marked as compatible for use with a class.
        Specified by:
        getAccessFlags in interface ClassDef
        Returns:
        The access flags for this class
      • getSourceFile

        @Nullable
        public java.lang.String getSourceFile()
        Description copied from interface: ClassDef
        Gets the name of the primary source file that this class is defined in, if available. This will be the default source file associated with all methods defined in this class. This can be overridden for sections of an individual method with the SetSourceFile debug item.
        Specified by:
        getSourceFile in interface ClassDef
        Returns:
        The name of the primary source file for this class, or null if not available
      • getInterfaces

        @Nonnull
        public java.util.List<java.lang.String> getInterfaces()
        Description copied from interface: ClassDef
        Gets a list of the interfaces that this class implements.
        Specified by:
        getInterfaces in interface ClassDef
        Returns:
        A list of the interfaces that this class implements
      • getAnnotations

        @Nonnull
        public java.util.Set<? extends DexBackedAnnotation> getAnnotations()
        Description copied from interface: ClassDef
        Gets a set of the annotations that are applied to this class. The annotations in the returned set are guaranteed to have unique types.
        Specified by:
        getAnnotations in interface Annotatable
        Specified by:
        getAnnotations in interface ClassDef
        Returns:
        A set of the annotations that are applied to this class
      • getStaticFields

        @Nonnull
        public java.lang.Iterable<? extends DexBackedField> getStaticFields()
        Description copied from interface: ClassDef
        Gets the static fields that are defined by this class. The static fields that are returned must have no duplicates.
        Specified by:
        getStaticFields in interface ClassDef
        Returns:
        The static fields that are defined by this class
      • getStaticFields

        @Nonnull
        public java.lang.Iterable<? extends DexBackedField> getStaticFields​(boolean skipDuplicates)
      • getInstanceFields

        @Nonnull
        public java.lang.Iterable<? extends DexBackedField> getInstanceFields()
        Description copied from interface: ClassDef
        Gets the instance fields that are defined by this class. The instance fields that are returned must have no duplicates.
        Specified by:
        getInstanceFields in interface ClassDef
        Returns:
        The instance fields that are defined by this class
      • getInstanceFields

        @Nonnull
        public java.lang.Iterable<? extends DexBackedField> getInstanceFields​(boolean skipDuplicates)
      • getFields

        @Nonnull
        public java.lang.Iterable<? extends DexBackedField> getFields()
        Description copied from interface: ClassDef
        Gets all the fields that are defined by this class. This is a convenience method that combines getStaticFields() and getInstanceFields() The returned fields may be in any order. I.e. It's not safe to assume that all instance fields will come after all static fields. Note that there typically should not be any duplicate fields between the two, but some versions of dalvik inadvertently allow duplicate static/instance fields, and are supported here for completeness
        Specified by:
        getFields in interface ClassDef
        Returns:
        A set of the fields that are defined by this class
      • getDirectMethods

        @Nonnull
        public java.lang.Iterable<? extends DexBackedMethod> getDirectMethods()
        Description copied from interface: ClassDef
        Gets the direct methods that are defined by this class. The direct methods that are returned must have no duplicates.
        Specified by:
        getDirectMethods in interface ClassDef
        Returns:
        The direct methods that are defined by this class.
      • getDirectMethods

        @Nonnull
        public java.lang.Iterable<? extends DexBackedMethod> getDirectMethods​(boolean skipDuplicates)
      • getVirtualMethods

        @Nonnull
        public java.lang.Iterable<? extends DexBackedMethod> getVirtualMethods​(boolean skipDuplicates)
      • getVirtualMethods

        @Nonnull
        public java.lang.Iterable<? extends DexBackedMethod> getVirtualMethods()
        Description copied from interface: ClassDef
        Gets the virtual methods that are defined by this class. The virtual methods that are returned must have no duplicates.
        Specified by:
        getVirtualMethods in interface ClassDef
        Returns:
        The virtual methods that are defined by this class.
      • getMethods

        @Nonnull
        public java.lang.Iterable<? extends DexBackedMethod> getMethods()
        Description copied from interface: ClassDef
        Gets all the methods that are defined by this class. This is a convenience method that combines getDirectMethods() and getVirtualMethods(). The returned methods may be in any order. I.e. It's not safe to assume that all virtual methods will come after all direct methods. Note that there typically should not be any duplicate methods between the two, but some versions of dalvik inadvertently allow duplicate direct/virtual methods, and are supported here for completeness
        Specified by:
        getMethods in interface ClassDef
        Returns:
        An iterable of the methods that are defined by this class.
      • getSize

        public int getSize()
        Calculate and return the private size of a class definition. Calculated as: class_def_item size + type_id size + interfaces type_list + annotations_directory_item overhead + class_data_item + static values overhead + methods size + fields size
        Returns:
        size in bytes