public class ConstraintViolationException extends IllegalArgumentException
The Constraint Violations are aggregated per method, and this exception will contain those violations, together with the Composite instance it happened on as well as the Method that was invoked. The Exception also has support for localized messages of these violations.
Constructor and Description |
---|
ConstraintViolationException(Composite instance,
Member method,
Collection<ConstraintViolation> constraintViolations) |
ConstraintViolationException(String instanceToString,
Iterable<Class<?>> instanceTypes,
Member method,
Collection<ConstraintViolation> violations) |
ConstraintViolationException(String instanceToString,
Iterable<Class<?>> instanceTypes,
String mixinTypeName,
String methodName,
Collection<ConstraintViolation> violations) |
Modifier and Type | Method and Description |
---|---|
Collection<ConstraintViolation> |
constraintViolations() |
String |
getLocalizedMessage() |
String |
getMessage() |
String |
localizedMessage() |
String[] |
localizedMessagesFrom(ResourceBundle bundle)
Creates localized messages of all the constraint violations that has occured.
|
String |
methodName() |
String |
mixinTypeName() |
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public ConstraintViolationException(Composite instance, Member method, Collection<ConstraintViolation> constraintViolations)
public ConstraintViolationException(String instanceToString, Iterable<Class<?>> instanceTypes, Member method, Collection<ConstraintViolation> violations)
public ConstraintViolationException(String instanceToString, Iterable<Class<?>> instanceTypes, String mixinTypeName, String methodName, Collection<ConstraintViolation> violations)
public Collection<ConstraintViolation> constraintViolations()
public String[] localizedMessagesFrom(ResourceBundle bundle)
The key "Qi4j_ConstraintViolation_CompositeType
" will be used to lookup the text formatting
pattern from the ResourceBundle, where CompositeType
is the
class name of the Composite where the constraint was violated. If such key does not exist, then the
key "Qi4j_ConstraintViolation
" will be used, and if that one also doesn't exist, or
the resourceBundle argument is null, then the default patterns will be used;
Type of Composite | Pattern used |
---|---|
Composite | Constraint Violation in {2}.{3} with constraint {4}, in composite \n{0} of type {1} |
EntityComposite | Constraint Violation in {2}.{3} with constraint {4}, in entity {1}[id={0}] |
ServiceComposite | Constraint Violation in {2}.{3} with constraint {4}, in service {0} |
Arg | Value |
---|---|
{0} | Composite instance toString() |
{1} | CompositeType class name |
{2} | MixinType class name |
{3} | MixinType method name |
{4} | Annotation toString() |
{5} | toString() of value passed as the argument, or "null" text if argument was null. |
NOTE!!! This class is still under construction and will be modified further.
bundle
- The ResourceBundle for Localization, or null if default formatting and locale to be used.public String localizedMessage()
public String getLocalizedMessage()
getLocalizedMessage
in class Throwable
public String getMessage()
getMessage
in class Throwable
public String methodName()
public String mixinTypeName()