Class Body.BodyBuilder

java.lang.Object
sootup.core.model.Body.BodyBuilder
All Implemented Interfaces:
HasPosition
Enclosing class:
Body

public static class Body.BodyBuilder extends Object implements HasPosition
The BodyBuilder helps to create a new Body in a fluent way (see Builder Pattern)
  • Method Details

    • getControlFlowGraph

      public @NonNull MutableControlFlowGraph getControlFlowGraph()
    • getStmts

      public @NonNull List<Stmt> getStmts()
    • getLocals

      public @NonNull Set<Local> getLocals()
    • setLocals

      public @NonNull Body.BodyBuilder setLocals(@NonNull Set<Local> locals)
    • addLocal

      public @NonNull Body.BodyBuilder addLocal(@NonNull Local local)
    • replaceLocal

      public void replaceLocal(@NonNull Local existingLocal, @NonNull Local newLocal)
    • replaceLocals

      public void replaceLocals(@NonNull Map<Local,Local> replacements)
      Replaces each key of the map by its value, like replaceLocal(Local, Local) for every entry, but in a single pass over the statements: a statement is only rewritten for the locals it uses or defines. Calling replaceLocal(Local, Local) for many locals scans the whole body for each of them.
      Parameters:
      replacements - the locals to replace (compared by identity) and their replacements
    • setModifiers

      public Body.BodyBuilder setModifiers(@NonNull Set<MethodModifier> modifiers)
    • getPosition

      public @Nullable Position getPosition()
      Description copied from interface: HasPosition
      Line and column information of the corresponding code object that this represents.
      Specified by:
      getPosition in interface HasPosition
      Returns:
      a Position containing position information.
    • setPosition

      public @NonNull Body.BodyBuilder setPosition(@NonNull Position position)
    • getMethodSignature

      public MethodSignature getMethodSignature()
    • setMethodSignature

      public Body.BodyBuilder setMethodSignature(@NonNull MethodSignature methodSig)
    • build

      public @NonNull Body build()
    • getModifiers

      public @NonNull Set<MethodModifier> getModifiers()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • removeDefLocalsOf

      public void removeDefLocalsOf(@NonNull Stmt stmt)