Package org.jf.dexlib2.analysis
Class ClassProto
- java.lang.Object
-
- org.jf.dexlib2.analysis.ClassProto
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassPath
classPath
protected boolean
interfacesFullyResolved
protected java.lang.String
type
protected java.util.Set<java.lang.String>
unresolvedInterfaces
protected boolean
vtableFullyResolved
-
Constructor Summary
Constructors Constructor Description ClassProto(ClassPath classPath, java.lang.String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
findMethodIndexInVtable(MethodReference method)
ClassDef
getClassDef()
ClassPath
getClassPath()
TypeProto
getCommonSuperclass(TypeProto other)
protected java.lang.Iterable<ClassDef>
getDirectInterfaces()
Gets the interfaces directly implemented by this class, or the interfaces they transitively implement.FieldReference
getFieldByOffset(int fieldOffset)
SparseArray<FieldReference>
getInstanceFields()
protected java.util.LinkedHashMap<java.lang.String,ClassDef>
getInterfaces()
Returns the set of interfaces that this class implements as a Map. Method
getMethodByVtableIndex(int vtableIndex)
java.lang.String
getSuperclass()
java.lang.String
getType()
protected java.util.Set<java.lang.String>
getUnresolvedInterfaces()
java.util.List<Method>
getVtable()
boolean
implementsInterface(java.lang.String iface)
Checks if this class implements the given interface.boolean
isInterface()
Returns true if this class is an interface.java.lang.String
toString()
-
-
-
Field Detail
-
classPath
@Nonnull protected final ClassPath classPath
-
type
@Nonnull protected final java.lang.String type
-
vtableFullyResolved
protected boolean vtableFullyResolved
-
interfacesFullyResolved
protected boolean interfacesFullyResolved
-
unresolvedInterfaces
protected java.util.Set<java.lang.String> unresolvedInterfaces
-
-
Constructor Detail
-
ClassProto
public ClassProto(@Nonnull ClassPath classPath, @Nonnull java.lang.String type)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getClassPath
@Nonnull public ClassPath getClassPath()
- Specified by:
getClassPath
in interfaceTypeProto
-
getClassDef
@Nonnull public ClassDef getClassDef()
-
isInterface
public boolean isInterface()
Returns true if this class is an interface. If this class is not defined, then this will throw an UnresolvedClassException- Specified by:
isInterface
in interfaceTypeProto
- Returns:
- True if this class is an interface
-
getInterfaces
@Nonnull protected java.util.LinkedHashMap<java.lang.String,ClassDef> getInterfaces()
Returns the set of interfaces that this class implements as a Map. The ClassDef value will be present only for the interfaces that this class directly implements (including any interfaces transitively implemented), but not for any interfaces that are only implemented by a superclass of this class For any interfaces that are only implemented by a superclass (or the class itself, if the class is an interface), the value will be null. If any interface couldn't be resolved, then the interfacesFullyResolved field will be set to false upon return. - Returns:
- the set of interfaces that this class implements as a Map
.
-
getUnresolvedInterfaces
@Nonnull protected java.util.Set<java.lang.String> getUnresolvedInterfaces()
-
getDirectInterfaces
@Nonnull protected java.lang.Iterable<ClassDef> getDirectInterfaces()
Gets the interfaces directly implemented by this class, or the interfaces they transitively implement. This does not include any interfaces that are only implemented by a superclass- Returns:
- An iterables of ClassDefs representing the directly or transitively implemented interfaces
- Throws:
UnresolvedClassException
- if interfaces could not be fully resolved
-
implementsInterface
public boolean implementsInterface(@Nonnull java.lang.String iface)
Checks if this class implements the given interface. If the interfaces of this class cannot be fully resolved then this method will either return true or throw an UnresolvedClassException- Specified by:
implementsInterface
in interfaceTypeProto
- Parameters:
iface
- The interface to check for- Returns:
- true if this class implements the given interface, otherwise false
- Throws:
UnresolvedClassException
- if the interfaces for this class could not be fully resolved, and the interface is not one of the interfaces that were successfully resolved
-
getSuperclass
@Nullable public java.lang.String getSuperclass()
- Specified by:
getSuperclass
in interfaceTypeProto
-
getCommonSuperclass
@Nonnull public TypeProto getCommonSuperclass(@Nonnull TypeProto other)
- Specified by:
getCommonSuperclass
in interfaceTypeProto
-
getFieldByOffset
@Nullable public FieldReference getFieldByOffset(int fieldOffset)
- Specified by:
getFieldByOffset
in interfaceTypeProto
-
getMethodByVtableIndex
@Nullable public Method getMethodByVtableIndex(int vtableIndex)
- Specified by:
getMethodByVtableIndex
in interfaceTypeProto
-
findMethodIndexInVtable
public int findMethodIndexInVtable(@Nonnull MethodReference method)
- Specified by:
findMethodIndexInVtable
in interfaceTypeProto
-
getInstanceFields
@Nonnull public SparseArray<FieldReference> getInstanceFields()
-
getVtable
@Nonnull public java.util.List<Method> getVtable()
-
-