Package sonia.scm

Class ScmConstraintViolationException.Builder

java.lang.Object
sonia.scm.ScmConstraintViolationException.Builder
Enclosing class:
ScmConstraintViolationException

public static class ScmConstraintViolationException.Builder extends Object
Builder to conditionally create constraint violations.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • doThrow

      public static ScmConstraintViolationException.Builder doThrow()
      Use this to create a new builder instance.
    • andThrow

      Resets this builder to check for further violations.
      Returns:
      this builder instance.
    • violation

      public ScmConstraintViolationException.Builder violation(String message, String... pathElements)
      Describes the violation with a custom message and the affected property. When more than one property is affected, you can call this method multiple times.
      Parameters:
      message - The message describing the violation.
      pathElements - The affected property denoted by the path to reach this property, e.g. "someParameter", "complexProperty", "attribute"
      Returns:
      this builder instance.
    • withFurtherInformation

      public ScmConstraintViolationException.Builder withFurtherInformation(String furtherInformation)
      Use this to specify a URL with further information about this violation and hints how to solve this. This is optional.
      Returns:
      this builder instance.
    • when

      public ScmConstraintViolationException.Builder when(boolean condition)
      When the given condition is true, an exception will be thrown. Otherwise, this simply resets this builder and does nothing else.
      Parameters:
      condition - The condition that indicates a violation of this constraint.
      Returns:
      this builder instance.