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(org.codehaus.groovy.ast.ClassNode type, org.codehaus.groovy.ast.MethodNode method) Adds the current class-invariant to the given method.voidgenerateInvariantAssertionStatement(org.codehaus.groovy.ast.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
public ClassInvariantGenerator(org.codehaus.groovy.control.io.ReaderSource source)
-
-
Method Details
-
generateInvariantAssertionStatement
public void generateInvariantAssertionStatement(org.codehaus.groovy.ast.ClassNode type, ClassInvariant classInvariant) 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
public void addInvariantAssertionStatement(org.codehaus.groovy.ast.ClassNode type, org.codehaus.groovy.ast.MethodNode method) Adds the current class-invariant to the given method.- Parameters:
type- theClassNodewhich declared the givenMethodNodemethod- the currentMethodNode
-