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
-
Field Summary
Fields inherited from class sootup.core.model.SootClass
classSignature, sourceType
Fields inherited from class sootup.core.model.AbstractClass
classSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet all annotations that are directly attached to this class.Returns the field of this class with the given name.getField
(FieldSubSignature subSignature) Attemtps to retrieve the field with the given FieldSubSignature.Attempts to retrieve the method with the given name and parameters.getMethod
(MethodSubSignature subSignature) Attempts to retrieve the method with the given subSignature.getMethodsByName
(String name) Attempts to retrieve the method with the given name.This method returns the outer class.WARNING: interfaces in Java are subclasses of the java.lang.Object class! Returns the superclass of this class.getType()
Returns the ClassSignature of this class.withFields
(Collection<JavaSootField> fields) withMethods
(Collection<JavaSootMethod> methods) withModifiers
(Set<ClassModifier> modifiers) withOuterClass
(Optional<JavaClassType> outerClass) Creates a new JavaSootClass based on a newOverridingJavaClassSource
.withPosition
(Position position) withReplacedField
(JavaSootField toReplace, JavaSootField replacement) withReplacedMethod
(JavaSootMethod toReplace, JavaSootMethod replacement) withSuperclass
(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
@Nonnull public 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
@Nonnull public 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
@Nonnull public JavaSootClass withReplacedMethod(@Nonnull JavaSootMethod toReplace, @Nonnull JavaSootMethod replacement) -
withMethods
-
withReplacedField
@Nonnull public JavaSootClass withReplacedField(@Nonnull JavaSootField toReplace, @Nonnull JavaSootField replacement) -
withFields
-
withModifiers
-
withSuperclass
-
withOuterClass
-
withPosition
-