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

  • Constructor Details

    • BaseGenerator

      protected BaseGenerator(ReaderSource source)
  • Method Details

    • getInvariantMethodName

      public static String getInvariantMethodName(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 MethodNode getInvariantMethodNode(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 BlockStatement getInlineModeBlockStatement(BlockStatement blockStatement)
    • wrapAssertionBooleanExpression

      protected BlockStatement wrapAssertionBooleanExpression(ClassNode type, MethodNode methodNode, BooleanExpression classInvariantExpression, String assertionType)
    • addCallsToSuperMethodNodeAnnotationClosure

      protected BooleanExpression addCallsToSuperMethodNodeAnnotationClosure(ClassNode type, MethodNode methodNode, Class<? extends Annotation> annotationType, BooleanExpression booleanExpression, boolean isPostcondition)