Package sonia.scm

Class ScmConstraintViolationException

All Implemented Interfaces:
Serializable

public class ScmConstraintViolationException extends RuntimeException implements 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: