Package com.ibm.wala.classLoader
Interface IClass
-
- All Superinterfaces:
IClassHierarchyDweller
- All Known Implementing Classes:
AndroidModelClass
,ArrayClass
,AstClass
,AstDynamicPropertyClass
,AstFunctionClass
,BypassSyntheticClass
,BytecodeClass
,DexIClass
,FakeRootClass
,JVMClass
,LambdaSummaryClass
,ShrikeClass
,SyntheticClass
public interface IClass extends IClassHierarchyDweller
Basic interface for an object that represents a single Java class for analysis purposes, including array classes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<IField>
getAllFields()
Compute the instance and static fields declared by this class or any of its superclasses.Collection<IClass>
getAllImplementedInterfaces()
Collection<IField>
getAllInstanceFields()
Compute the instance fields declared by this class or any of its superclasses.Collection<IMethod>
getAllMethods()
Compute the methods declared by this class or any of its superclasses.Collection<IField>
getAllStaticFields()
Compute the static fields declared by this class or any of its superclasses.Collection<Annotation>
getAnnotations()
get annotations, if anyIMethod
getClassInitializer()
IClassLoader
getClassLoader()
Return the object that represents the defining class loader for this class.Collection<IField>
getDeclaredInstanceFields()
Compute the instance fields declared by this class.Collection<IMethod>
getDeclaredMethods()
Collection<IField>
getDeclaredStaticFields()
Collection<? extends IClass>
getDirectInterfaces()
IField
getField(Atom name)
Finds a field.IField
getField(Atom name, TypeName type)
Finds a field, given a name and a type.IMethod
getMethod(Selector selector)
Finds method matching signature.int
getModifiers()
Return the integer that encodes the class's modifiers, as defined by the JVM specificationTypeName
getName()
TypeReference
getReference()
Reader
getSource()
String
getSourceFileName()
IClass
getSuperclass()
boolean
isAbstract()
boolean
isArrayClass()
boolean
isInterface()
Is this class a Java interface?boolean
isPrivate()
boolean
isPublic()
boolean
isReferenceType()
Does 'this' refer to a reference type? If not, then it refers to a primitive type.-
Methods inherited from interface com.ibm.wala.ipa.cha.IClassHierarchyDweller
getClassHierarchy
-
-
-
-
Method Detail
-
getClassLoader
IClassLoader getClassLoader()
Return the object that represents the defining class loader for this class.- Returns:
- the object that represents the defining class loader for this class.
-
isInterface
boolean isInterface()
Is this class a Java interface?
-
isAbstract
boolean isAbstract()
- Returns:
- true iff this class is abstract
-
isPublic
boolean isPublic()
- Returns:
- true iff this class is public
-
isPrivate
boolean isPrivate()
- Returns:
- true iff this class is private
-
getModifiers
int getModifiers() throws UnsupportedOperationException
Return the integer that encodes the class's modifiers, as defined by the JVM specification- Returns:
- the integer that encodes the class's modifiers, as defined by the JVM specification
- Throws:
UnsupportedOperationException
-
getSuperclass
IClass getSuperclass()
- Returns:
- the superclass, or null if java.lang.Object
- Throws:
IllegalStateException
- if there's some problem determining the superclass
-
getDirectInterfaces
Collection<? extends IClass> getDirectInterfaces()
- Returns:
- Collection of (IClass) interfaces this class directly implements. If this class is an interface, returns the interfaces it immediately extends.
-
getAllImplementedInterfaces
Collection<IClass> getAllImplementedInterfaces()
- Returns:
- Collection of (IClass) interfaces this class implements, including all ancestors of interfaces immediately implemented. If this class is an interface, it returns all super-interfaces.
-
getMethod
IMethod getMethod(Selector selector)
Finds method matching signature. Delegates to superclass if not found.- Parameters:
selector
- a method signature- Returns:
- IMethod from this class matching the signature; null if not found in this class or any superclass.
-
getField
IField getField(Atom name)
Finds a field.- Throws:
IllegalStateException
- if the class contains multiple fields with namename
.
-
getField
IField getField(Atom name, TypeName type)
Finds a field, given a name and a type. Returnsnull
if not found.
-
getReference
TypeReference getReference()
- Returns:
- canonical TypeReference corresponding to this class
-
getSourceFileName
String getSourceFileName() throws NoSuchElementException
- Returns:
- String holding the name of the source file that defined this class, or null if none found
- Throws:
NoSuchElementException
- if this class was generated from more than one source file The assumption that a class is generated from a single source file is java specific, and will change in the future. In place of this API, use the APIs in IClassLoader. SJF .. we should think about this deprecation. postponing deprecation for now.
-
getSource
Reader getSource() throws NoSuchElementException
- Returns:
- String representing the source file holding this class, or null if not found
- Throws:
NoSuchElementException
- if this class was generated from more than one source file The assumption that a class is generated from a single source file is java specific, and will change in the future. In place of this API, use the APIs in IClassLoader. SJF .. we should think about this deprecation. postponing deprecation for now.
-
getClassInitializer
IMethod getClassInitializer()
- Returns:
- the method that is this class's initializer, or null if none
-
isArrayClass
boolean isArrayClass()
- Returns:
- true iff the class is an array class.
-
getDeclaredMethods
Collection<IMethod> getDeclaredMethods()
- Returns:
- an Iterator of the IMethods declared by this class.
-
getAllInstanceFields
Collection<IField> getAllInstanceFields()
Compute the instance fields declared by this class or any of its superclasses.
-
getAllStaticFields
Collection<IField> getAllStaticFields()
Compute the static fields declared by this class or any of its superclasses.
-
getAllFields
Collection<IField> getAllFields()
Compute the instance and static fields declared by this class or any of its superclasses.
-
getAllMethods
Collection<IMethod> getAllMethods()
Compute the methods declared by this class or any of its superclasses.
-
getDeclaredInstanceFields
Collection<IField> getDeclaredInstanceFields()
Compute the instance fields declared by this class.- Returns:
- Collection of IFields
-
getDeclaredStaticFields
Collection<IField> getDeclaredStaticFields()
- Returns:
- Collection of IField
-
getName
TypeName getName()
- Returns:
- the TypeName for this class
-
isReferenceType
boolean isReferenceType()
Does 'this' refer to a reference type? If not, then it refers to a primitive type.
-
getAnnotations
Collection<Annotation> getAnnotations()
get annotations, if any
-
-