Package sootup.java.core
Class JavaSootClass
java.lang.Object
sootup.core.model.AbstractClass
sootup.core.model.SootClass
sootup.java.core.JavaSootClass
- All Implemented Interfaces:
HasPosition
,HasAnnotation
- Direct Known Subclasses:
JavaAnnotationSootClass
-
Nested Class Summary
Nested classes/interfaces inherited from class sootup.core.model.SootClass
SootClass.SootClassBuilder
-
Field Summary
Fields inherited from class sootup.core.model.SootClass
classSignature, sourceType
Fields inherited from class sootup.core.model.AbstractClass
classSource
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull Iterable<AnnotationUsage>
Get all annotations that are directly attached to this class.@NonNull JavaSootClassSource
@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>
@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 Optional<JavaClassType>
This method returns the outer class.@NonNull Optional<JavaClassType>
WARNING: interfaces in Java are subclasses of the java.lang.Object class!@NonNull JavaClassType
getType()
Returns the ClassSignature of this class.@NonNull JavaSootClass
withFields
(@NonNull Collection<JavaSootField> fields) @NonNull JavaSootClass
withMethods
(@NonNull Collection<JavaSootMethod> methods) @NonNull JavaSootClass
withModifiers
(@NonNull Set<ClassModifier> modifiers) @NonNull JavaSootClass
withOuterClass
(@NonNull Optional<JavaClassType> outerClass) @NonNull JavaSootClass
Creates a new JavaSootClass based on a newOverridingJavaClassSource
.@NonNull JavaSootClass
withPosition
(@Nullable Position position) @NonNull JavaSootClass
withReplacedField
(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) @NonNull JavaSootClass
withReplacedMethod
(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) @NonNull JavaSootClass
withSuperclass
(@NonNull Optional<JavaClassType> superclass) Methods inherited from class sootup.core.model.SootClass
getInterfaces, getModifiers, getName, getPosition, hasOuterClass, hasSuperclass, implementsInterface, isAbstract, isAnnotation, isApplicationClass, isConcrete, isEnum, isFinal, isInnerClass, isInterface, isLibraryClass, isPrivate, isProtected, isPublic, isStatic, isSuper, print, toString, withClassSource, withSourceType
-
Constructor Details
-
JavaSootClass
-
-
Method Details
-
getType
Description copied from class:SootClass
Returns the ClassSignature of this class. -
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:
getAnnotations
in interfaceHasAnnotation
- Returns:
-
getMethods
Description copied from class:SootClass
- Overrides:
getMethods
in classSootClass
-
getFields
Description copied from class:SootClass
-
getField
Description copied from class:AbstractClass
Returns 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.- Overrides:
getField
in classAbstractClass
-
getField
Description copied from class:AbstractClass
Attemtps to retrieve the field with the given FieldSubSignature.- Overrides:
getField
in classAbstractClass
-
getMethod
public @NonNull Optional<JavaSootMethod> getMethod(@NonNull String name, @NonNull Iterable<? extends Type> parameterTypes) Description copied from class:AbstractClass
Attempts 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.- Overrides:
getMethod
in classAbstractClass
-
getMethodsByName
Description copied from class:AbstractClass
Attempts to retrieve the method with the given name. This method will return an empty Set if there is no method with the given name.- Overrides:
getMethodsByName
in classAbstractClass
- Parameters:
name
- the name of the method- Returns:
- a set of methods that have the given name
-
getMethod
Description copied from class:AbstractClass
Attempts 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.- Overrides:
getMethod
in classAbstractClass
-
getClassSource
- Overrides:
getClassSource
in classSootClass
-
getOuterClass
Description copied from class:SootClass
This method returns the outer class.- Overrides:
getOuterClass
in classSootClass
-
getSuperclass
Description copied from class:SootClass
WARNING: interfaces in Java are subclasses of the java.lang.Object class! Returns the superclass of this class. (see hasSuperclass())- Overrides:
getSuperclass
in classSootClass
-
withOverridingClassSource
public @NonNull JavaSootClass withOverridingClassSource(Function<OverridingJavaClassSource, OverridingJavaClassSource> overrider) Creates a new JavaSootClass based on a newOverridingJavaClassSource
. This is useful to change selected parts of aSootClass
without recreating aJavaSootClassSource
completely.OverridingJavaClassSource
allows for replacing specific parts of a class, such as fields and methods. -
withReplacedMethod
public @NonNull JavaSootClass withReplacedMethod(@NonNull JavaSootMethod toReplace, @NonNull JavaSootMethod replacement) -
withMethods
-
withReplacedField
public @NonNull JavaSootClass withReplacedField(@NonNull JavaSootField toReplace, @NonNull JavaSootField replacement) -
withFields
-
withModifiers
-
withSuperclass
-
withOuterClass
-
withPosition
-