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.
-
-
Field Summary
-
Fields inherited from class org.apache.groovy.contracts.generation.BaseGenerator
INVARIANT_CLOSURE_PREFIX, META_DATA_USE_INLINE_MODE, source
-
-
Constructor Summary
Constructors Constructor Description PreconditionGenerator(ReaderSource source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
generateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode)
Generates the default precondition statement forMethodNode
instances with thePrecondition
annotation.void
generatePreconditionAssertionStatement(MethodNode method, Precondition precondition)
Injects a precondition assertion statement in the given method, based on the given annotation of typeRequires
.-
Methods inherited from class org.apache.groovy.contracts.generation.BaseGenerator
addCallsToSuperMethodNodeAnnotationClosure, getInlineModeBlockStatement, getInvariantMethodName, getInvariantMethodNode, wrapAssertionBooleanExpression
-
-
-
-
Constructor Detail
-
PreconditionGenerator
public PreconditionGenerator(ReaderSource source)
-
-
Method Detail
-
generatePreconditionAssertionStatement
public void generatePreconditionAssertionStatement(MethodNode method, Precondition precondition)
Injects a precondition assertion statement in the given method, based on the given annotation of typeRequires
.- Parameters:
method
- theMethodNode
for assertion injectionprecondition
- thePrecondition
the assertion statement should be generated from
-
generateDefaultPreconditionStatement
public void generateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode)
Generates the default precondition statement forMethodNode
instances with thePrecondition
annotation.- Parameters:
type
- the currentClassNode
methodNode
- theMethodNode
with aPrecondition
annotation
-
-