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 voidgenerateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode)Generates the default precondition statement forMethodNodeinstances with thePreconditionannotation.voidgeneratePreconditionAssertionStatement(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- theMethodNodefor assertion injectionprecondition- thePreconditionthe assertion statement should be generated from
-
generateDefaultPreconditionStatement
public void generateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode)
Generates the default precondition statement forMethodNodeinstances with thePreconditionannotation.- Parameters:
type- the currentClassNodemethodNode- theMethodNodewith aPreconditionannotation
-
-