Package org.jf.dexlib2.dexbacked
Class DexBackedClassDef
java.lang.Object
org.jf.dexlib2.base.reference.BaseReference
org.jf.dexlib2.base.reference.BaseTypeReference
org.jf.dexlib2.dexbacked.DexBackedClassDef
- All Implemented Interfaces:
CharSequence,Comparable<CharSequence>,Annotatable,ClassDef,Reference,TypeReference
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.jf.dexlib2.iface.reference.Reference
Reference.InvalidReferenceException -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnnotationsDirectoryprivate final intfinal DexBackedDexFileprivate final intprivate intprivate final DexBackedClassDef.HiddenApiRestrictionsReaderprivate final intprivate int(package private) static final intprivate final intprivate final intprivate final intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionDexBackedClassDef(DexBackedDexFile dexFile, int classDefOffset, int hiddenApiRestrictionsOffset) -
Method Summary
Modifier and TypeMethodDescriptionintGets the access flags for this class.Set<? extends DexBackedAnnotation> Gets a set of the annotations that are applied to this class.private AnnotationsDirectoryIterable<? extends DexBackedMethod> Gets the direct methods that are defined by this class.Iterable<? extends DexBackedMethod> getDirectMethods(boolean skipDuplicates) private intIterable<? extends DexBackedField> Gets all the fields that are defined by this class.Iterable<? extends DexBackedField> Gets the instance fields that are defined by this class.Iterable<? extends DexBackedField> getInstanceFields(boolean skipDuplicates) private intGets a list of the interfaces that this class implements.Iterable<? extends DexBackedMethod> Gets all the methods that are defined by this class.intgetSize()Calculate and return the private size of a class definition.Gets the name of the primary source file that this class is defined in, if available.Iterable<? extends DexBackedField> Gets the static fields that are defined by this class.Iterable<? extends DexBackedField> getStaticFields(boolean skipDuplicates) Gets the superclass of this class.getType()Gets the class type.Iterable<? extends DexBackedMethod> Gets the virtual methods that are defined by this class.Iterable<? extends DexBackedMethod> getVirtualMethods(boolean skipDuplicates) private intMethods inherited from class org.jf.dexlib2.base.reference.BaseTypeReference
charAt, compareTo, equals, hashCode, length, subSequence, toStringMethods inherited from class org.jf.dexlib2.base.reference.BaseReference
validateReferenceMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, isEmpty, length, subSequence, toStringMethods inherited from interface org.jf.dexlib2.iface.reference.Reference
validateReferenceMethods inherited from interface org.jf.dexlib2.iface.reference.TypeReference
compareTo, equals, hashCode
-
Field Details
-
NO_HIDDEN_API_RESTRICTIONS
static final int NO_HIDDEN_API_RESTRICTIONS- See Also:
-
dexFile
-
classDefOffset
private final int classDefOffset -
staticFieldsOffset
private final int staticFieldsOffset -
instanceFieldsOffset
private int instanceFieldsOffset -
directMethodsOffset
private int directMethodsOffset -
virtualMethodsOffset
private int virtualMethodsOffset -
staticFieldCount
private final int staticFieldCount -
instanceFieldCount
private final int instanceFieldCount -
directMethodCount
private final int directMethodCount -
virtualMethodCount
private final int virtualMethodCount -
annotationsDirectory
-
-
Constructor Details
-
DexBackedClassDef
public DexBackedClassDef(@Nonnull DexBackedDexFile dexFile, int classDefOffset, int hiddenApiRestrictionsOffset)
-
-
Method Details
-
getType
Description copied from interface:ClassDefGets the class type. This will be a type descriptor per the dex file specification.- Specified by:
getTypein interfaceClassDef- Specified by:
getTypein interfaceTypeReference- Returns:
- The class type
-
getSuperclass
Description copied from interface:ClassDefGets the superclass of this class. This will only be null if this is the base java.lang.Object class.- Specified by:
getSuperclassin interfaceClassDef- Returns:
- The superclass of this class
-
getAccessFlags
public int getAccessFlags()Description copied from interface:ClassDefGets 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:
getAccessFlagsin interfaceClassDef- Returns:
- The access flags for this class
-
getSourceFile
Description copied from interface:ClassDefGets 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:
getSourceFilein interfaceClassDef- Returns:
- The name of the primary source file for this class, or null if not available
-
getInterfaces
Description copied from interface:ClassDefGets a list of the interfaces that this class implements.- Specified by:
getInterfacesin interfaceClassDef- Returns:
- A list of the interfaces that this class implements
-
getAnnotations
Description copied from interface:ClassDefGets 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:
getAnnotationsin interfaceAnnotatable- Specified by:
getAnnotationsin interfaceClassDef- Returns:
- A set of the annotations that are applied to this class
-
getStaticFields
Description copied from interface:ClassDefGets the static fields that are defined by this class. The static fields that are returned must have no duplicates.- Specified by:
getStaticFieldsin interfaceClassDef- Returns:
- The static fields that are defined by this class
-
getStaticFields
-
getInstanceFields
Description copied from interface:ClassDefGets the instance fields that are defined by this class. The instance fields that are returned must have no duplicates.- Specified by:
getInstanceFieldsin interfaceClassDef- Returns:
- The instance fields that are defined by this class
-
getInstanceFields
-
getFields
Description copied from interface:ClassDefGets 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 -
getDirectMethods
Description copied from interface:ClassDefGets the direct methods that are defined by this class. The direct methods that are returned must have no duplicates.- Specified by:
getDirectMethodsin interfaceClassDef- Returns:
- The direct methods that are defined by this class.
-
getDirectMethods
-
getVirtualMethods
-
getVirtualMethods
Description copied from interface:ClassDefGets the virtual methods that are defined by this class. The virtual methods that are returned must have no duplicates.- Specified by:
getVirtualMethodsin interfaceClassDef- Returns:
- The virtual methods that are defined by this class.
-
getMethods
Description copied from interface:ClassDefGets 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:
getMethodsin interfaceClassDef- Returns:
- An iterable of the methods that are defined by this class.
-
getAnnotationsDirectory
-
getInstanceFieldsOffset
private int getInstanceFieldsOffset() -
getDirectMethodsOffset
private int getDirectMethodsOffset() -
getVirtualMethodsOffset
private int getVirtualMethodsOffset() -
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
-