Class BaseGenerator

java.lang.Object
org.apache.groovy.contracts.generation.BaseGenerator
Direct Known Subclasses:
ClassInvariantGenerator, PostconditionGenerator, PreconditionGenerator

public abstract class BaseGenerator extends Object
Base class for groovy-contracts code generators.
  • Field Details

    • INVARIANT_CLOSURE_PREFIX

      public static final String INVARIANT_CLOSURE_PREFIX
      See Also:
    • META_DATA_USE_INLINE_MODE

      public static final String META_DATA_USE_INLINE_MODE
      See Also:
    • source

      protected final org.codehaus.groovy.control.io.ReaderSource source
  • Constructor Details

    • BaseGenerator

      protected BaseGenerator(org.codehaus.groovy.control.io.ReaderSource source)
  • Method Details

    • getInvariantMethodName

      public static String getInvariantMethodName(org.codehaus.groovy.ast.ClassNode classNode)
      Parameters:
      classNode - the ClassNode used to look up the invariant closure field
      Returns:
      the field name of the invariant closure field of the given classNode
    • getInvariantMethodNode

      public static org.codehaus.groovy.ast.MethodNode getInvariantMethodNode(org.codehaus.groovy.ast.ClassNode classNode)
      Parameters:
      classNode - the ClassNode used to look up the invariant closure field
      Returns:
      the MethodNode which contains the invariant of the given classNode
    • getInlineModeBlockStatement

      protected org.codehaus.groovy.ast.stmt.BlockStatement getInlineModeBlockStatement(org.codehaus.groovy.ast.stmt.BlockStatement blockStatement)
    • wrapAssertionBooleanExpression

      protected org.codehaus.groovy.ast.stmt.BlockStatement wrapAssertionBooleanExpression(org.codehaus.groovy.ast.ClassNode type, org.codehaus.groovy.ast.MethodNode methodNode, org.codehaus.groovy.ast.expr.BooleanExpression classInvariantExpression, String assertionType)
    • addCallsToSuperMethodNodeAnnotationClosure

      protected org.codehaus.groovy.ast.expr.BooleanExpression addCallsToSuperMethodNodeAnnotationClosure(org.codehaus.groovy.ast.ClassNode type, org.codehaus.groovy.ast.MethodNode methodNode, Class<? extends Annotation> annotationType, org.codehaus.groovy.ast.expr.BooleanExpression booleanExpression, boolean isPostcondition)