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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateDefaultPreconditionStatement(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 Details
-
PreconditionGenerator
-
-
Method Details
-
generatePreconditionAssertionStatement
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
Generates the default precondition statement forMethodNodeinstances with thePreconditionannotation.- Parameters:
type- the currentClassNodemethodNode- theMethodNodewith aPreconditionannotation
-