Package sonia.scm
Class ScmConstraintViolationException.Builder
java.lang.Object
sonia.scm.ScmConstraintViolationException.Builder
- Enclosing class:
- ScmConstraintViolationException
Builder to conditionally create constraint violations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandThrow()
Resets this builder to check for further violations.doThrow()
Use this to create a new builder instance.Describes the violation with a custom message and the affected property.when
(boolean condition) When the given condition istrue
, an exception will be thrown.withFurtherInformation
(String furtherInformation) Use this to specify a URL with further information about this violation and hints how to solve this.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
doThrow
Use this to create a new builder instance. -
andThrow
Resets this builder to check for further violations.- Returns:
- this builder instance.
-
violation
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
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
When the given condition istrue
, 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.
-