Class PrintingContext

java.lang.Object
spoon.reflect.visitor.PrintingContext

public class PrintingContext extends Object
  • Constructor Details

    • PrintingContext

      public PrintingContext()
  • Method Details

    • isFirstForVariable

      public boolean isFirstForVariable()
      Returns:
      true if we are printing first variable declaration of CtFor statement
    • isNextForVariable

      public boolean isNextForVariable()
      Returns:
      true if we are printing second or next variable declaration of CtFor statement
    • ignoreGenerics

      public boolean ignoreGenerics()
      Returns:
      true if we are ignore generics while printing statement, false otherwise.
    • skipArray

      public boolean skipArray()
      Returns:
      true if we skip the array brackets, false otherwise.
    • ignoreStaticAccess

      public boolean ignoreStaticAccess()
      Returns:
      true if we skip printing the static access, false otherwise.
    • ignoreEnclosingClass

      public boolean ignoreEnclosingClass()
      Returns:
      true if we skip printing the enclosing class, false access, false otherwise.
    • forceWildcardGenerics

      public boolean forceWildcardGenerics()
      Returns:
      true if we force printing the generic wildcard '?', false otherwise.
    • isStatement

      public boolean isStatement(CtStatement stmt)
      Returns:
      true if `stmt` has to be handled as statement in current printing context
    • getCurrentTypeReference

      public CtTypeReference<?> getCurrentTypeReference()
      Returns:
      the current top level type or null if no type is defined.
    • pushCurrentThis

      public void pushCurrentThis(CtType<?> type)
      Adds the given type to the stack of types.
      Parameters:
      type - the type to add.
    • popCurrentThis

      public void popCurrentThis()
      Removes the current type context from the stack.
    • toString

      public String toString()
      (non-Javadoc)
      Overrides:
      toString in class Object
      See Also:
      Object.toString()
    • isInCurrentScope

      public boolean isInCurrentScope(CtTypeReference<?> typeRef)
      Parameters:
      typeRef - used to check if we are in the context of this type.
      Returns:
      true if typeRef is equal to current (actually printed) Type (currentThis)
    • modify

      public PrintingContext.Writable modify()
      Creates a new Writable instance, coping the current state and statement if set.
      Returns:
      a new PrintingContext.Writable instance.