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 String
INVARIANT_CLOSURE_PREFIX
static String
META_DATA_USE_INLINE_MODE
protected ReaderSource
source
-
Constructor Summary
Constructors Constructor Description BaseGenerator(ReaderSource source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BooleanExpression
addCallsToSuperMethodNodeAnnotationClosure(ClassNode type, MethodNode methodNode, Class<? extends Annotation> annotationType, BooleanExpression booleanExpression, boolean isPostcondition)
protected BlockStatement
getInlineModeBlockStatement(BlockStatement blockStatement)
static String
getInvariantMethodName(ClassNode classNode)
static MethodNode
getInvariantMethodNode(ClassNode classNode)
protected BlockStatement
wrapAssertionBooleanExpression(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
- theClassNode
used 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
- theClassNode
used to look up the invariant closure field- Returns:
- the
MethodNode
which 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)
-
-