|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.bval.jsr303.ConstraintValidationListener<T>
public final class ConstraintValidationListener<T>
Description: JSR-303 ValidationListener
implementation; provides ConstraintViolation
s.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.bval.model.ValidationListener |
---|
ValidationListener.Error |
Constructor Summary | |
---|---|
ConstraintValidationListener(T aRootBean,
Class<T> rootBeanType)
Create a new ConstraintValidationListener instance. |
Method Summary | ||
---|---|---|
|
addError(String reason,
ValidationContext<VL> context)
Simple API to add an error reason during validation. |
|
|
addError(ValidationListener.Error error,
ValidationContext<VL> context)
Alternative method to add a fully initialized ValidationListener.Error object. |
|
boolean |
beginReportAsSingle()
Signify the beginning of a report-as-single-violation composite validation. |
|
boolean |
endReportAsSingle()
Signify the end of a report-as-single-violation composite validation. |
|
Set<ConstraintViolation<T>> |
getConstraintViolations()
Get the ConstraintViolation s accumulated by this ConstraintValidationListener . |
|
T |
getRootBean()
Get the root bean. |
|
Class<T> |
getRootBeanType()
Get the root bean type of this ConstraintValidationListener . |
|
boolean |
hasViolations()
Learn whether there are violations available. |
|
boolean |
isEmpty()
Learn whether no violations were found. |
|
int |
violationsSize()
Get the count of encountered violations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConstraintValidationListener(T aRootBean, Class<T> rootBeanType)
aRootBean
- rootBeanType
- Method Detail |
---|
public <VL extends ValidationListener> void addError(String reason, ValidationContext<VL> context)
Validation
with context information
taken from the given ValidationContext
.
addError
in interface ValidationListener
reason
- a constant describing the reason. This is normally the key of the
feature that was violated in the object 'owner' for property 'propertyName'context
- - contains
bean = the object that contains the error (owner)
propertyName = the Name of the attribute that caused the errorpublic <VL extends ValidationListener> void addError(ValidationListener.Error error, ValidationContext<VL> context)
ValidationListener.Error
object.
addError
in interface ValidationListener
public Set<ConstraintViolation<T>> getConstraintViolations()
ConstraintViolation
s accumulated by this ConstraintValidationListener
.
Set
of ConstraintViolation
public boolean isEmpty()
public T getRootBean()
public Class<T> getRootBeanType()
ConstraintValidationListener
.
public int violationsSize()
public boolean hasViolations()
public boolean beginReportAsSingle()
true
as this call caused the listener to enter report-as-single-violation modepublic boolean endReportAsSingle()
true
as this call caused the listener to exit report-as-single-violation mode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |