Package org.jf.dexlib2.immutable
Class ImmutableClassDef
- java.lang.Object
-
- org.jf.dexlib2.base.reference.BaseReference
-
- org.jf.dexlib2.base.reference.BaseTypeReference
-
- org.jf.dexlib2.immutable.ImmutableClassDef
-
- All Implemented Interfaces:
java.lang.CharSequence
,java.lang.Comparable<java.lang.CharSequence>
,Annotatable
,ClassDef
,Reference
,TypeReference
public class ImmutableClassDef extends BaseTypeReference implements ClassDef
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jf.dexlib2.iface.reference.Reference
Reference.InvalidReferenceException
-
-
Field Summary
Fields Modifier and Type Field Description protected int
accessFlags
protected com.google.common.collect.ImmutableSet<? extends ImmutableAnnotation>
annotations
protected com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod>
directMethods
protected com.google.common.collect.ImmutableSortedSet<? extends ImmutableField>
instanceFields
protected com.google.common.collect.ImmutableList<java.lang.String>
interfaces
protected java.lang.String
sourceFile
protected com.google.common.collect.ImmutableSortedSet<? extends ImmutableField>
staticFields
protected java.lang.String
superclass
protected java.lang.String
type
protected com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod>
virtualMethods
-
Constructor Summary
Constructors Constructor Description ImmutableClassDef(java.lang.String type, int accessFlags, java.lang.String superclass, com.google.common.collect.ImmutableList<java.lang.String> interfaces, java.lang.String sourceFile, com.google.common.collect.ImmutableSet<? extends ImmutableAnnotation> annotations, com.google.common.collect.ImmutableSortedSet<? extends ImmutableField> staticFields, com.google.common.collect.ImmutableSortedSet<? extends ImmutableField> instanceFields, com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod> directMethods, com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod> virtualMethods)
ImmutableClassDef(java.lang.String type, int accessFlags, java.lang.String superclass, java.util.Collection<java.lang.String> interfaces, java.lang.String sourceFile, java.util.Collection<? extends Annotation> annotations, java.lang.Iterable<? extends Field> staticFields, java.lang.Iterable<? extends Field> instanceFields, java.lang.Iterable<? extends Method> directMethods, java.lang.Iterable<? extends Method> virtualMethods)
ImmutableClassDef(java.lang.String type, int accessFlags, java.lang.String superclass, java.util.Collection<java.lang.String> interfaces, java.lang.String sourceFile, java.util.Collection<? extends Annotation> annotations, java.lang.Iterable<? extends Field> fields, java.lang.Iterable<? extends Method> methods)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAccessFlags()
Gets the access flags for this class.com.google.common.collect.ImmutableSet<? extends ImmutableAnnotation>
getAnnotations()
Gets a set of the annotations that are applied to this class.com.google.common.collect.ImmutableSet<? extends ImmutableMethod>
getDirectMethods()
Gets the direct methods that are defined by this class.java.util.Collection<? extends ImmutableField>
getFields()
Gets all the fields that are defined by this class.com.google.common.collect.ImmutableSet<? extends ImmutableField>
getInstanceFields()
Gets the instance fields that are defined by this class.com.google.common.collect.ImmutableList<java.lang.String>
getInterfaces()
Gets a list of the interfaces that this class implements.java.util.Collection<? extends ImmutableMethod>
getMethods()
Gets all the methods that are defined by this class.java.lang.String
getSourceFile()
Gets the name of the primary source file that this class is defined in, if available.com.google.common.collect.ImmutableSet<? extends ImmutableField>
getStaticFields()
Gets the static fields that are defined by this class.java.lang.String
getSuperclass()
Gets the superclass of this class.java.lang.String
getType()
Gets the class type.com.google.common.collect.ImmutableSet<? extends ImmutableMethod>
getVirtualMethods()
Gets the virtual methods that are defined by this class.static com.google.common.collect.ImmutableSet<ImmutableClassDef>
immutableSetOf(java.lang.Iterable<? extends ClassDef> iterable)
static ImmutableClassDef
of(ClassDef classDef)
-
Methods inherited from class org.jf.dexlib2.base.reference.BaseTypeReference
charAt, compareTo, equals, hashCode, length, subSequence, toString
-
Methods inherited from class org.jf.dexlib2.base.reference.BaseReference
validateReference
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, length, subSequence, toString
-
Methods inherited from interface org.jf.dexlib2.iface.reference.Reference
validateReference
-
Methods inherited from interface org.jf.dexlib2.iface.reference.TypeReference
compareTo, equals, hashCode
-
-
-
-
Field Detail
-
type
@Nonnull protected final java.lang.String type
-
accessFlags
protected final int accessFlags
-
superclass
@Nullable protected final java.lang.String superclass
-
interfaces
@Nonnull protected final com.google.common.collect.ImmutableList<java.lang.String> interfaces
-
sourceFile
@Nullable protected final java.lang.String sourceFile
-
annotations
@Nonnull protected final com.google.common.collect.ImmutableSet<? extends ImmutableAnnotation> annotations
-
staticFields
@Nonnull protected final com.google.common.collect.ImmutableSortedSet<? extends ImmutableField> staticFields
-
instanceFields
@Nonnull protected final com.google.common.collect.ImmutableSortedSet<? extends ImmutableField> instanceFields
-
directMethods
@Nonnull protected final com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod> directMethods
-
virtualMethods
@Nonnull protected final com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod> virtualMethods
-
-
Constructor Detail
-
ImmutableClassDef
public ImmutableClassDef(@Nonnull java.lang.String type, int accessFlags, @Nullable java.lang.String superclass, @Nullable java.util.Collection<java.lang.String> interfaces, @Nullable java.lang.String sourceFile, @Nullable java.util.Collection<? extends Annotation> annotations, @Nullable java.lang.Iterable<? extends Field> fields, @Nullable java.lang.Iterable<? extends Method> methods)
-
ImmutableClassDef
public ImmutableClassDef(@Nonnull java.lang.String type, int accessFlags, @Nullable java.lang.String superclass, @Nullable java.util.Collection<java.lang.String> interfaces, @Nullable java.lang.String sourceFile, @Nullable java.util.Collection<? extends Annotation> annotations, @Nullable java.lang.Iterable<? extends Field> staticFields, @Nullable java.lang.Iterable<? extends Field> instanceFields, @Nullable java.lang.Iterable<? extends Method> directMethods, @Nullable java.lang.Iterable<? extends Method> virtualMethods)
-
ImmutableClassDef
public ImmutableClassDef(@Nonnull java.lang.String type, int accessFlags, @Nullable java.lang.String superclass, @Nullable com.google.common.collect.ImmutableList<java.lang.String> interfaces, @Nullable java.lang.String sourceFile, @Nullable com.google.common.collect.ImmutableSet<? extends ImmutableAnnotation> annotations, @Nullable com.google.common.collect.ImmutableSortedSet<? extends ImmutableField> staticFields, @Nullable com.google.common.collect.ImmutableSortedSet<? extends ImmutableField> instanceFields, @Nullable com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod> directMethods, @Nullable com.google.common.collect.ImmutableSortedSet<? extends ImmutableMethod> virtualMethods)
-
-
Method Detail
-
of
public static ImmutableClassDef of(ClassDef classDef)
-
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 interfaceClassDef
- Specified by:
getType
in interfaceTypeReference
- Returns:
- The class type
-
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 interfaceClassDef
- Returns:
- The access flags for this class
-
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 interfaceClassDef
- Returns:
- The superclass of this class
-
getInterfaces
@Nonnull public com.google.common.collect.ImmutableList<java.lang.String> getInterfaces()
Description copied from interface:ClassDef
Gets a list of the interfaces that this class implements.- Specified by:
getInterfaces
in interfaceClassDef
- Returns:
- A list of the interfaces that this class implements
-
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 interfaceClassDef
- Returns:
- The name of the primary source file for this class, or null if not available
-
getAnnotations
@Nonnull public com.google.common.collect.ImmutableSet<? extends ImmutableAnnotation> 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 interfaceAnnotatable
- Specified by:
getAnnotations
in interfaceClassDef
- Returns:
- A set of the annotations that are applied to this class
-
getStaticFields
@Nonnull public com.google.common.collect.ImmutableSet<? extends ImmutableField> 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 interfaceClassDef
- Returns:
- The static fields that are defined by this class
-
getInstanceFields
@Nonnull public com.google.common.collect.ImmutableSet<? extends ImmutableField> 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 interfaceClassDef
- Returns:
- The instance fields that are defined by this class
-
getDirectMethods
@Nonnull public com.google.common.collect.ImmutableSet<? extends ImmutableMethod> 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 interfaceClassDef
- Returns:
- The direct methods that are defined by this class.
-
getVirtualMethods
@Nonnull public com.google.common.collect.ImmutableSet<? extends ImmutableMethod> 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 interfaceClassDef
- Returns:
- The virtual methods that are defined by this class.
-
getFields
@Nonnull public java.util.Collection<? extends ImmutableField> 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
-
getMethods
@Nonnull public java.util.Collection<? extends ImmutableMethod> 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 interfaceClassDef
- Returns:
- An iterable of the methods that are defined by this class.
-
immutableSetOf
@Nonnull public static com.google.common.collect.ImmutableSet<ImmutableClassDef> immutableSetOf(@Nullable java.lang.Iterable<? extends ClassDef> iterable)
-
-