Package sootup.java.core
Class JavaSootClass
java.lang.Object
sootup.java.core.JavaSootClass
- All Implemented Interfaces:
HasPosition,SootClass,HasAnnotation
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionJavaSootClass(SootClassSource classSource, SourceType sourceType) JavaSootClass(SootClassSource classSource, SourceType sourceType, Set<JavaSootMethod> methods, Set<? extends SootField> fields, Set<ClassModifier> modifiers, Set<? extends ClassType> interfaces, Optional<? extends ClassType> superclass, Optional<? extends ClassType> outerClass, Position position) -
Method Summary
Modifier and TypeMethodDescriptionResturns the default values of methods in AnnotationsGet all annotations that are directly attached to this class.@NonNull SootClassSource@NonNull Optional<JavaSootField>Returns the field of this class with the given name.@NonNull Optional<JavaSootField>getField(@NonNull FieldSubSignature subSignature) Attemtps to retrieve the field with the given FieldSubSignature.@NonNull Set<JavaSootField>Returns a backed Chain of the interfaces that are directly implemented by this class.@NonNull Optional<JavaSootMethod>Attempts to retrieve the method with the given name and parameters.@NonNull Optional<JavaSootMethod>getMethod(@NonNull MethodSubSignature subSignature) Attempts to retrieve the method with the given subSignature.@NonNull Set<JavaSootMethod>@NonNull Set<JavaSootMethod>getMethodsByName(@NonNull String name) Attempts to retrieve the method with the given name.@NonNull Set<ClassModifier>Returns the modifiers of this class in an immutable set.@NonNull StringgetName()This method returns the outer class.@NonNull PositionLine and column information of the corresponding code object that this represents.WARNING: interfaces in Java are subclasses of the java.lang.Object class!getType()Returns the ClassSignature of this class.booleanbooleanWARNING: interfaces are subclasses of the java.lang.Object class!booleanimplementsInterface(@NonNull ClassType classSignature) Does this class directly implement the given interface?booleanConvenience method returning true if this class is abstract.booleanbooleanReturns true if this class is an application class.booleanReturns true if this class is not an interface and not abstract.booleanisEnum()Convenience method; returns true if this class is an enumeration.booleanisFinal()Convenience method returning true if this class is final.booleanbooleanConvenience method; returns true if this class is an interface.booleanReturns true if this class is a library class.booleanConvenience method returning true if this class is private.booleanConvenience method returning true if this class is protected.booleanisPublic()Convenience method; returns true if this class is public.booleanisStatic()Convenience method returning true if this class is static.booleanisSuper()Convenience method; returns true if this class is synchronized.@NonNull Stringprint()Returns the serialized Jimple of this SootClass as String@NonNull StringtoString()Returns the name of this class.@NonNull JavaSootClasswithClassSource(@NonNull SootClassSource classSource) @NonNull JavaSootClasswithFields(@NonNull Collection<JavaSootField> fields) @NonNull JavaSootClasswithMethods(@NonNull Collection<JavaSootMethod> methods) @NonNull JavaSootClasswithModifiers(@NonNull Set<ClassModifier> modifiers) @NonNull JavaSootClasswithOuterClass(@NonNull Optional<JavaClassType> outerClass) @NonNull JavaSootClasswithPosition(@Nullable Position position) @NonNull JavaSootClasswithReplacedField(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) @NonNull JavaSootClasswithReplacedMethod(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) @NonNull JavaSootClasswithSourceType(@NonNull SourceType sourceType) @NonNull JavaSootClasswithSuperclass(@NonNull Optional<JavaClassType> superclass)
-
Constructor Details
-
JavaSootClass
-
JavaSootClass
public JavaSootClass(SootClassSource classSource, SourceType sourceType, Set<JavaSootMethod> methods, Set<? extends SootField> fields, Set<ClassModifier> modifiers, Set<? extends ClassType> interfaces, Optional<? extends ClassType> superclass, Optional<? extends ClassType> outerClass, Position position)
-
-
Method Details
-
getMethod
Description copied from interface:SootClassAttempts to retrieve the method with the given subSignature. This method may throw an AmbiguousStateException if there are more than one method with the given subSignature. If no method with the given is found, null is returned. -
getField
Description copied from interface:SootClassAttemtps to retrieve the field with the given FieldSubSignature. -
getField
Description copied from interface:SootClassReturns the field of this class with the given name. Throws a ResolveException if there is more than one field with the given name. Returns null if no field with the given name exists. -
getMethod
public @NonNull Optional<JavaSootMethod> getMethod(@NonNull String name, @NonNull Iterable<? extends Type> parameterTypes) Description copied from interface:SootClassAttempts to retrieve the method with the given name and parameters. This method may throw an ResolveException if there is more than one method with the given name and parameter. -
getMethodsByName
Description copied from interface:SootClassAttempts to retrieve the method with the given name. This method will return an empty Set if there is no method with the given name.- Specified by:
getMethodsByNamein interfaceSootClass- Parameters:
name- the name of the method- Returns:
- a set of methods that have the given name
-
getMethods
- Specified by:
getMethodsin interfaceSootClass
-
getFields
-
getModifiers
Returns the modifiers of this class in an immutable set.- Specified by:
getModifiersin interfaceSootClass
-
getInterfaces
Returns a backed Chain of the interfaces that are directly implemented by this class. Note that direct implementation corresponds to an "implements" keyword in the Java class file and that this class may still be implementing additional interfaces in the usual sense by being a subclass of a class which directly implements some interfaces.- Specified by:
getInterfacesin interfaceSootClass
-
implementsInterface
Does this class directly implement the given interface? (see getInterfaceCount()) -
hasSuperclass
public boolean hasSuperclass()WARNING: interfaces are subclasses of the java.lang.Object class! Does this class have a superclass? False implies that this is the java.lang.Object class. Note that interfaces are subclasses of the java.lang.Object class.- Specified by:
hasSuperclassin interfaceSootClass
-
getSuperclass
WARNING: interfaces in Java are subclasses of the java.lang.Object class! Returns the superclass of this class. (see hasSuperclass())- Specified by:
getSuperclassin interfaceSootClass
-
hasOuterClass
public boolean hasOuterClass()- Specified by:
hasOuterClassin interfaceSootClass
-
getOuterClass
This method returns the outer class.- Specified by:
getOuterClassin interfaceSootClass
-
isInnerClass
public boolean isInnerClass()- Specified by:
isInnerClassin interfaceSootClass
-
getType
Returns the ClassSignature of this class. -
isInterface
public boolean isInterface()Convenience method; returns true if this class is an interface.- Specified by:
isInterfacein interfaceSootClass
-
isEnum
public boolean isEnum()Convenience method; returns true if this class is an enumeration. -
isSuper
public boolean isSuper()Convenience method; returns true if this class is synchronized. -
isConcrete
public boolean isConcrete()Returns true if this class is not an interface and not abstract.- Specified by:
isConcretein interfaceSootClass
-
isPublic
public boolean isPublic()Convenience method; returns true if this class is public. -
toString
Returns the name of this class. -
print
Returns the serialized Jimple of this SootClass as String -
isApplicationClass
public boolean isApplicationClass()Returns true if this class is an application class.- Specified by:
isApplicationClassin interfaceSootClass
-
isLibraryClass
public boolean isLibraryClass()Returns true if this class is a library class.- Specified by:
isLibraryClassin interfaceSootClass
-
isPrivate
public boolean isPrivate()Convenience method returning true if this class is private. -
isProtected
public boolean isProtected()Convenience method returning true if this class is protected.- Specified by:
isProtectedin interfaceSootClass
-
isAbstract
public boolean isAbstract()Convenience method returning true if this class is abstract.- Specified by:
isAbstractin interfaceSootClass
-
isFinal
public boolean isFinal()Convenience method returning true if this class is final. -
isStatic
public boolean isStatic()Convenience method returning true if this class is static. -
isAnnotation
public boolean isAnnotation()- Specified by:
isAnnotationin interfaceSootClass
-
getPosition
Description copied from interface:HasPositionLine and column information of the corresponding code object that this represents.- Specified by:
getPositionin interfaceHasPosition- Specified by:
getPositionin interfaceSootClass- Returns:
- a
Positioncontaining position information.
-
getClassSource
- Specified by:
getClassSourcein interfaceSootClass
-
getName
-
withClassSource
-
withSourceType
-
withMethods
-
withReplacedField
public @NonNull JavaSootClass withReplacedField(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) -
withFields
-
withModifiers
-
withReplacedMethod
public @NonNull JavaSootClass withReplacedMethod(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) -
withSuperclass
-
withOuterClass
-
withPosition
-
getAnnotations
Get all annotations that are directly attached to this class.This includes "visible" and "invisible" annotations. Note that inherited annotations are not part of this iterable.
- Specified by:
getAnnotationsin interfaceHasAnnotation
-
getAnnotationDefaultValues
Resturns the default values of methods in Annotations- Returns:
- a Map mapping the method name to the default value if the SootClass is no Annotation, it will return an empty map.
-