Package sonia.scm
Class ScmConstraintViolationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
sonia.scm.ScmConstraintViolationException
- All Implemented Interfaces:
Serializable
Use this exception to handle invalid input values that cannot be handled using
JEE bean validation.
Use the
ScmConstraintViolationException.Builder
to conditionally create a new exception:
Builder .doThrow() .violation("name or alias must not be empty if not anonymous", "myParameter", "name") .violation("name or alias must not be empty if not anonymous", "myParameter", "alias") .when(myParameter.getName() == null && myParameter.getAlias() == null && !myParameter.isAnonymous()) .andThrow() .violation("name must be empty if anonymous", "myParameter", "name") .when(myParameter.getName() != null && myParameter.isAnonymous());Mind that using this way you do not have to use if-else constructs.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder to conditionally create constraint violations.static class
A single constraint violation. -
Method Summary
Modifier and TypeMethodDescriptiongetUrl()
An optional URL for more information about this constraint violation.The violations that caused this exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
getViolations
The violations that caused this exception. -
getUrl
An optional URL for more information about this constraint violation.
-