Class Assertion<T extends Assertion>
java.lang.Object
org.apache.groovy.contracts.domain.Assertion<T>
- Type Parameters:
T- the concrete assertion subtype used for logical composition
- Direct Known Subclasses:
ClassInvariant,LoopInvariant,Postcondition,Precondition
Base class for all assertion types.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an assertion that defaults totrue.Assertion(BlockStatement blockStatement, BooleanExpression booleanExpression) Creates an assertion backed by the original block and normalized boolean expression. -
Method Summary
Modifier and TypeMethodDescriptionvoidConjoins this assertion with another assertion of the same kind.Returns the boolean expression used when generating the runtime assertion.voidDisjoins this assertion with another assertion of the same kind.Returns the original block statement from which this assertion was derived.voidrenew(BooleanExpression booleanExpression) Replaces the current boolean expression while preserving the existing source mapping strategy.
-
Constructor Details
-
Assertion
public Assertion()Creates an assertion that defaults totrue. -
Assertion
Creates an assertion backed by the original block and normalized boolean expression.- Parameters:
blockStatement- the original contract block, ornullif unavailablebooleanExpression- the normalized expression to evaluate
-
-
Method Details
-
booleanExpression
Returns the boolean expression used when generating the runtime assertion.- Returns:
- the current boolean expression
-
originalBlockStatement
Returns the original block statement from which this assertion was derived.- Returns:
- the original contract block, or
nullif it is unavailable
-
renew
Replaces the current boolean expression while preserving the existing source mapping strategy.- Parameters:
booleanExpression- the new boolean expression
-
and
Conjoins this assertion with another assertion of the same kind.- Parameters:
other- the assertion to combine with a logical AND
-
or
Disjoins this assertion with another assertion of the same kind.- Parameters:
other- the assertion to combine with a logical OR
-