Class PreconditionGenerator
java.lang.Object
org.apache.groovy.contracts.generation.BaseGenerator
org.apache.groovy.contracts.generation.PreconditionGenerator
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 Details
-
PreconditionGenerator
-
-
Method Details
-
generatePreconditionAssertionStatement
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
Generates the default precondition statement forMethodNode
instances with thePrecondition
annotation.- Parameters:
type
- the currentClassNode
methodNode
- theMethodNode
with aPrecondition
annotation
-