org.axonframework.commandhandling.interceptors
Class JSR303ViolationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.axonframework.common.AxonException
                  extended by org.axonframework.common.AxonNonTransientException
                      extended by org.axonframework.commandhandling.StructuralCommandValidationFailedException
                          extended by org.axonframework.commandhandling.interceptors.JSR303ViolationException
All Implemented Interfaces:
Serializable

public class JSR303ViolationException
extends StructuralCommandValidationFailedException

Specialized version of the StructuralCommandValidationFailedException that provides a set of JSR303 constraint violations that provide details about the exact failure of the command.

Since:
1.1
Author:
Allard Buijze
See Also:
Serialized Form

Constructor Summary
JSR303ViolationException(Set<javax.validation.ConstraintViolation<Object>> violations)
          Initializes an exception with the given message and violations.
 
Method Summary
protected static String convert(Set<javax.validation.ConstraintViolation<Object>> violations)
          Convert the violations to a human readable format, sorted by class and property e.g.
 Set<javax.validation.ConstraintViolation<Object>> getViolations()
          Returns the violations that were detected when this exception was thrown.
 
Methods inherited from class org.axonframework.common.AxonNonTransientException
isCauseOf
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSR303ViolationException

public JSR303ViolationException(Set<javax.validation.ConstraintViolation<Object>> violations)
Initializes an exception with the given message and violations.

Parameters:
violations - The violations that were detected
Method Detail

getViolations

public Set<javax.validation.ConstraintViolation<Object>> getViolations()
Returns the violations that were detected when this exception was thrown.

Returns:
the violations that were detected when this exception was thrown

convert

protected static String convert(Set<javax.validation.ConstraintViolation<Object>> violations)
Convert the violations to a human readable format, sorted by class and property e.g.
   property ab in class my.some.Klass may not be null
   property cd in class my.some.OtherClass length must be between 0 and 3
   property cd in class my.some.OtherClass must match "ab.*"

 
property notNull in class my.some.TheClass may not be null



Copyright © 2010-2016. All Rights Reserved.