Package org.jf.dexlib2.analysis
Class ClassProto
- java.lang.Object
-
- org.jf.dexlib2.analysis.ClassProto
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassPathclassPathprotected booleaninterfacesFullyResolvedprotected java.lang.Stringtypeprotected java.util.Set<java.lang.String>unresolvedInterfacesprotected booleanvtableFullyResolved
-
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 intfindMethodIndexInVtable(MethodReference method)ClassDefgetClassDef()ClassPathgetClassPath()TypeProtogetCommonSuperclass(TypeProto other)protected java.lang.Iterable<ClassDef>getDirectInterfaces()Gets the interfaces directly implemented by this class, or the interfaces they transitively implement.FieldReferencegetFieldByOffset(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. MethodgetMethodByVtableIndex(int vtableIndex)java.lang.StringgetSuperclass()java.lang.StringgetType()protected java.util.Set<java.lang.String>getUnresolvedInterfaces()java.util.List<Method>getVtable()booleanimplementsInterface(java.lang.String iface)Checks if this class implements the given interface.booleanisInterface()Returns true if this class is an interface.java.lang.StringtoString()
-
-
-
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:
toStringin classjava.lang.Object
-
getClassPath
@Nonnull public ClassPath getClassPath()
- Specified by:
getClassPathin 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:
isInterfacein 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:
implementsInterfacein 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:
getSuperclassin interfaceTypeProto
-
getCommonSuperclass
@Nonnull public TypeProto getCommonSuperclass(@Nonnull TypeProto other)
- Specified by:
getCommonSuperclassin interfaceTypeProto
-
getFieldByOffset
@Nullable public FieldReference getFieldByOffset(int fieldOffset)
- Specified by:
getFieldByOffsetin interfaceTypeProto
-
getMethodByVtableIndex
@Nullable public Method getMethodByVtableIndex(int vtableIndex)
- Specified by:
getMethodByVtableIndexin interfaceTypeProto
-
findMethodIndexInVtable
public int findMethodIndexInVtable(@Nonnull MethodReference method)- Specified by:
findMethodIndexInVtablein interfaceTypeProto
-
getInstanceFields
@Nonnull public SparseArray<FieldReference> getInstanceFields()
-
getVtable
@Nonnull public java.util.List<Method> getVtable()
-
-