Class BaseGenerator
- java.lang.Object
-
- org.apache.groovy.contracts.generation.BaseGenerator
-
- Direct Known Subclasses:
ClassInvariantGenerator,PostconditionGenerator,PreconditionGenerator
public abstract class BaseGenerator extends Object
Base class for groovy-contracts code generators.
-
-
Field Summary
Fields Modifier and Type Field Description static StringINVARIANT_CLOSURE_PREFIXstatic StringMETA_DATA_USE_INLINE_MODEprotected ReaderSourcesource
-
Constructor Summary
Constructors Constructor Description BaseGenerator(ReaderSource source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BooleanExpressionaddCallsToSuperMethodNodeAnnotationClosure(ClassNode type, MethodNode methodNode, Class<? extends Annotation> annotationType, BooleanExpression booleanExpression, boolean isPostcondition)protected BlockStatementgetInlineModeBlockStatement(BlockStatement blockStatement)static StringgetInvariantMethodName(ClassNode classNode)static MethodNodegetInvariantMethodNode(ClassNode classNode)protected BlockStatementwrapAssertionBooleanExpression(ClassNode type, MethodNode methodNode, BooleanExpression classInvariantExpression, String assertionType)
-
-
-
Field Detail
-
INVARIANT_CLOSURE_PREFIX
public static final String INVARIANT_CLOSURE_PREFIX
- See Also:
- Constant Field Values
-
META_DATA_USE_INLINE_MODE
public static final String META_DATA_USE_INLINE_MODE
- See Also:
- Constant Field Values
-
source
protected final ReaderSource source
-
-
Constructor Detail
-
BaseGenerator
public BaseGenerator(ReaderSource source)
-
-
Method Detail
-
getInvariantMethodName
public static String getInvariantMethodName(ClassNode classNode)
- Parameters:
classNode- theClassNodeused to look up the invariant closure field- Returns:
- the field name of the invariant closure field of the given classNode
-
getInvariantMethodNode
public static MethodNode getInvariantMethodNode(ClassNode classNode)
- Parameters:
classNode- theClassNodeused to look up the invariant closure field- Returns:
- the
MethodNodewhich contains the invariant of the given classNode
-
getInlineModeBlockStatement
protected BlockStatement getInlineModeBlockStatement(BlockStatement blockStatement)
-
wrapAssertionBooleanExpression
protected BlockStatement wrapAssertionBooleanExpression(ClassNode type, MethodNode methodNode, BooleanExpression classInvariantExpression, String assertionType)
-
addCallsToSuperMethodNodeAnnotationClosure
protected BooleanExpression addCallsToSuperMethodNodeAnnotationClosure(ClassNode type, MethodNode methodNode, Class<? extends Annotation> annotationType, BooleanExpression booleanExpression, boolean isPostcondition)
-
-