Package org.apache.groovy.contracts

# Class ViolationTracker

java.lang.Object
org.apache.groovy.contracts.ViolationTracker

public class ViolationTracker extends Object

A violation tracker is used to keep a list of pre-, post-condition or class-invariant violations in chronological order. This is necessary to evaluate all parts of a pre- or postcondition, and still being able to rethrow assertion errors.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static ThreadLocal<ViolationTracker>`
  `INSTANCE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ViolationTracker()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `deinit()`
  `AssertionViolation`
  `first()`
  `boolean`
  `hasViolations()`
  `static void`
  `init()`
  `AssertionViolation`
  `last()`
  `static void`
  `rethrowFirst()`
  `static void`
  `rethrowLast()`
  `void`
  `track(AssertionViolation assertionViolation)`
  `static boolean`
  `violationsOccurred()`

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

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

- ## Field Details

  - ### INSTANCE

    public static ThreadLocal<ViolationTracker> INSTANCE

- ## Constructor Details

  - ### ViolationTracker

    public ViolationTracker()

- ## Method Details

  - ### init

    public static void init()

  - ### deinit

    public static void deinit()

  - ### violationsOccurred

    public static boolean violationsOccurred()

  - ### rethrowFirst

    public static void rethrowFirst()

  - ### rethrowLast

    public static void rethrowLast()

  - ### track

    public void track(AssertionViolation assertionViolation)

  - ### hasViolations

    public boolean hasViolations()

  - ### first

    public AssertionViolation first()

  - ### last

    public AssertionViolation last()