groovy / 4.0 / org / apache / groovy / contracts / generation / preconditiongenerator.html

[Java] Class PreconditionGenerator

  • org.apache.groovy.contracts.generation.PreconditionGenerator
public class PreconditionGenerator
extends BaseGenerator

Code generator for preconditions.

Inherited fields
Fields inherited from class Fields
class BaseGenerator INVARIANT_CLOSURE_PREFIX, META_DATA_USE_INLINE_MODE, source

Constructor Summary

Constructors
Constructor and description
PreconditionGenerator(ReaderSource source)

Methods Summary

Methods
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

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 ClassNode
methodNode - 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 injection
precondition - 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