Class ClassInvariantGenerator
- java.lang.Object
-
- org.apache.groovy.contracts.generation.BaseGenerator
-
- org.apache.groovy.contracts.generation.ClassInvariantGenerator
-
public class ClassInvariantGenerator extends BaseGenerator
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 Constructor Description ClassInvariantGenerator(ReaderSource source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 Detail
-
ClassInvariantGenerator
public ClassInvariantGenerator(ReaderSource source)
-
-
Method Detail
-
generateInvariantAssertionStatement
public void generateInvariantAssertionStatement(ClassNode type, ClassInvariant classInvariant)
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
public void addInvariantAssertionStatement(ClassNode type, MethodNode method)
Adds the current class-invariant to the given method.- Parameters:
type
- theClassNode
which declared the givenMethodNode
method
- the currentMethodNode
-
-