Class ClassInvariantGenerator
java.lang.Object
org.apache.groovy.contracts.generation.BaseGenerator
org.apache.groovy.contracts.generation.ClassInvariantGenerator
Code generator for class invariants.
-
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
addInvariantAssertionStatement
(ClassNode type, MethodNode method) Adds the current class-invariant to the given method.void
generateInvariantAssertionStatement
(ClassNode type, ClassInvariant classInvariant) Reads theInvariant
boolean expression and generates a synthetic method holding this class invariant.Methods inherited from class org.apache.groovy.contracts.generation.BaseGenerator
addCallsToSuperMethodNodeAnnotationClosure, getInlineModeBlockStatement, getInvariantMethodName, getInvariantMethodNode, wrapAssertionBooleanExpression
-
Constructor Details
-
ClassInvariantGenerator
-
-
Method Details
-
generateInvariantAssertionStatement
Reads theInvariant
boolean expression and generates a synthetic method holding this class invariant. This is used for heir calls to find out about inherited class invariants.- Parameters:
type
- the currentClassNode
classInvariant
- theClassInvariant
the assertion statement should be generated from
-
addInvariantAssertionStatement
Adds the current class-invariant to the given method.- Parameters:
type
- theClassNode
which declared the givenMethodNode
method
- the currentMethodNode
-