Class PreconditionGenerator

java.lang.Object
org.apache.groovy.contracts.generation.BaseGenerator
org.apache.groovy.contracts.generation.PreconditionGenerator

public class PreconditionGenerator extends BaseGenerator
Code generator for preconditions.
  • Constructor Details

    • PreconditionGenerator

      public PreconditionGenerator(ReaderSource source)
  • Method Details

    • generatePreconditionAssertionStatement

      public void generatePreconditionAssertionStatement(MethodNode method, Precondition precondition)
      Injects a precondition assertion statement in the given method, based on the given annotation of type Requires.
      Parameters:
      method - the MethodNode for assertion injection
      precondition - the Precondition the assertion statement should be generated from
    • generateDefaultPreconditionStatement

      public void generateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode)
      Generates the default precondition statement for MethodNode instances with the Precondition annotation.
      Parameters:
      type - the current ClassNode
      methodNode - the MethodNode with a Precondition annotation