On this page
[Java] Class PreconditionGenerator
- org.apache.groovy.contracts.generation.PreconditionGenerator
public class PreconditionGenerator
extends BaseGenerator
Code generator for preconditions.
Fields inherited from class | Fields |
---|---|
class BaseGenerator |
INVARIANT_CLOSURE_PREFIX, META_DATA_USE_INLINE_MODE, source |
Constructor Summary
Constructor and description |
---|
PreconditionGenerator(ReaderSource source) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public void |
generateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode) Generates the default precondition statement for MethodNode instances with the Precondition annotation. |
|
public void |
generatePreconditionAssertionStatement(MethodNode method, Precondition precondition) Injects a precondition assertion statement in the given method, based on the given annotation of type Requires. |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class BaseGenerator |
addCallsToSuperMethodNodeAnnotationClosure, getInlineModeBlockStatement, getInvariantMethodName, getInvariantMethodNode, wrapAssertionBooleanExpression |
Constructor Detail
public PreconditionGenerator(ReaderSource source)
Method Detail
public void generateDefaultPreconditionStatement(ClassNode type, MethodNode methodNode)
Generates the default precondition statement for MethodNode instances with the Precondition annotation.
- Parameters:
type
- the current ClassNodemethodNode
- the MethodNode with a Precondition annotation
public void generatePreconditionAssertionStatement(MethodNode method, Precondition precondition)
Injects a precondition assertion statement in the given method, based on the given annotation of type Requires.
- Parameters:
method
- the MethodNode for assertion injectionprecondition
- the Precondition the assertion statement should be generated from
© 2003-2022 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/4.0.0/html/gapi/org/apache/groovy/contracts/generation/PreconditionGenerator.html