Class Contract
java.lang.Object
org.apache.groovy.contracts.domain.Contract
Represents a contract between a supplier and a customer of a class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current class invariant.Returns the class represented by this contract.booleanIndicates whether the contract still uses the shared default class invariant.Returns the postconditions indexed by method.Returns the preconditions indexed by method.voidsetClassInvariant(ClassInvariant classInvariant) Replaces the class invariant associated with this contract.
-
Constructor Details
-
Contract
Creates a contract model for the supplied class.- Parameters:
classNode- the class described by this contract
-
-
Method Details
-
classNode
Returns the class represented by this contract.- Returns:
- the contracted class node
-
setClassInvariant
Replaces the class invariant associated with this contract.- Parameters:
classInvariant- the invariant to store
-
preconditions
Returns the preconditions indexed by method.- Returns:
- the precondition map
-
postconditions
Returns the postconditions indexed by method.- Returns:
- the postcondition map
-
hasDefaultClassInvariant
public boolean hasDefaultClassInvariant()Indicates whether the contract still uses the shared default class invariant.- Returns:
trueif no custom class invariant has been set
-
classInvariant
Returns the current class invariant.- Returns:
- the configured class invariant
-