Package org.apache.groovy.contracts.domain

# Class ClassInvariant

java.lang.Object
org.apache.groovy.contracts.domain.Assertion<ClassInvariant>
org.apache.groovy.contracts.domain.ClassInvariant

public class ClassInvariant extends Assertion<ClassInvariant>

A class-invariant assertion.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ClassInvariant`
  `DEFAULT`
  Shared invariant instance representing an unconstrained class invariant.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClassInvariant()`
  Creates a class invariant that defaults to `true`.
  `ClassInvariant(BlockStatement blockStatement, BooleanExpression booleanExpression)`
  Creates a class invariant from the supplied source block and boolean expression.

- ## Method Summary

  ### Methods inherited from class org.apache.groovy.contracts.domain.Assertion

  `and, booleanExpression, or, originalBlockStatement, renew`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT

    public static final ClassInvariant DEFAULT
    Shared invariant instance representing an unconstrained class invariant.

- ## Constructor Details

  - ### ClassInvariant

    public ClassInvariant()
    Creates a class invariant that defaults to `true`.

  - ### ClassInvariant

    public ClassInvariant(BlockStatement blockStatement, BooleanExpression booleanExpression)
    Creates a class invariant from the supplied source block and boolean expression.
    Parameters:
      `blockStatement` - the original invariant block
      `booleanExpression` - the normalized invariant expression