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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInvariantAssertionStatement(ClassNode type, MethodNode method) Adds the current class-invariant to the given method.voidgenerateInvariantAssertionStatement(ClassNode type, ClassInvariant classInvariant) Reads theInvariantboolean 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 theInvariantboolean 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 currentClassNodeclassInvariant- theClassInvariantthe assertion statement should be generated from
-
addInvariantAssertionStatement
Adds the current class-invariant to the given method.- Parameters:
type- theClassNodewhich declared the givenMethodNodemethod- the currentMethodNode
-