public class ViolationCollector extends Object
Constructor and Description |
---|
ViolationCollector(javax.validation.ConstraintValidatorContext constraintValidatorContext) |
ViolationCollector(javax.validation.ConstraintValidatorContext constraintValidatorContext,
boolean escapeExpressions) |
Modifier and Type | Method and Description |
---|---|
void |
addViolation(String message)
Adds a new violation to this collector.
|
void |
addViolation(String propertyName,
Integer index,
String message)
Adds a new violation to this collector.
|
void |
addViolation(String propertyName,
Integer index,
String message,
Map<String,Object> messageParameters)
Adds a new violation to this collector.
|
void |
addViolation(String message,
Map<String,Object> messageParameters)
Adds a new violation to this collector.
|
void |
addViolation(String propertyName,
String message)
Adds a new violation to this collector.
|
void |
addViolation(String propertyName,
String message,
Map<String,Object> messageParameters)
Adds a new violation to this collector.
|
void |
addViolation(String propertyName,
String key,
String message)
Adds a new violation to this collector.
|
void |
addViolation(String propertyName,
String key,
String message,
Map<String,Object> messageParameters)
Adds a new violation to this collector.
|
javax.validation.ConstraintValidatorContext |
getContext()
This method returns the wrapped context for raw access to the validation framework.
|
boolean |
hasViolationOccurred() |
void |
setViolationOccurred(boolean violationOccurred)
Manually sets if a violation occurred.
|
public ViolationCollector(javax.validation.ConstraintValidatorContext constraintValidatorContext)
public ViolationCollector(javax.validation.ConstraintValidatorContext constraintValidatorContext, boolean escapeExpressions)
public void addViolation(String message)
violationOccurred
to true
.
Prefer the method with explicit message parameters if you want to interpolate the message.
message
- the message of the violationaddViolation(String, Map)
public void addViolation(String message, Map<String,Object> messageParameters)
violationOccurred
to true
.message
- the message of the violationmessageParameters
- a map of message parameters which can be interpolated in the violation messagepublic void addViolation(String propertyName, String message)
violationOccurred
to true
.
Prefer the method with explicit message parameters if you want to interpolate the message.
propertyName
- the name of the propertymessage
- the message of the violationaddViolation(String, String, Map)
public void addViolation(String propertyName, String message, Map<String,Object> messageParameters)
violationOccurred
to true
.propertyName
- the name of the propertymessage
- the message of the violationmessageParameters
- a map of message parameters which can be interpolated in the violation messagepublic void addViolation(String propertyName, Integer index, String message)
violationOccurred
to true
.
Prefer the method with explicit message parameters if you want to interpolate the message.propertyName
- the name of the property with the violationindex
- the index of the element with the violationmessage
- the message of the violation (any EL expression will be escaped and not parsed)addViolation(String, Integer, String, Map)
public void addViolation(String propertyName, Integer index, String message, Map<String,Object> messageParameters)
violationOccurred
to true
.propertyName
- the name of the property with the violationindex
- the index of the element with the violationmessage
- the message of the violationmessageParameters
- a map of message parameters which can be interpolated in the violation messagepublic void addViolation(String propertyName, String key, String message)
violationOccurred
to true
.propertyName
- the name of the property with the violationkey
- the key of the element with the violationmessage
- the message of the violationpublic void addViolation(String propertyName, String key, String message, Map<String,Object> messageParameters)
violationOccurred
to true
.propertyName
- the name of the property with the violationkey
- the key of the element with the violationmessage
- the message of the violationmessageParameters
- a map of message parameters which can be interpolated in the violation messagepublic javax.validation.ConstraintValidatorContext getContext()
setViolationOccurred(true)
.public boolean hasViolationOccurred()
public void setViolationOccurred(boolean violationOccurred)
addViolation
is called.violationOccurred
- if any violation was collectedCopyright © 2021. All rights reserved.