|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.validator.Status
public class Status
Models a validation status. An instance of this class is encapsulated
by a ValidationContext. It holds the current validation
errors (if any).
From within the Validate method of a Rule, validation
errors must be signaled through one of this class' error()
methods, as in the following:
// 'this' is the current Rule instance.
...
public void validate(ValidationContext ctx){
ctx.getStatus().error(this);
}
...
| Constructor Summary | |
|---|---|
Status(ValidationContext ctx)
Constructor for Status. |
|
| Method Summary | |
|---|---|
void |
addError(ValidationErr err)
|
void |
addErrors(List errs)
|
void |
error(Rule r)
Registers a validation error for the given rule. |
void |
error(Rule r,
String msg)
Registers an error for the given Rule. |
void |
error(Rule r,
Throwable err)
Registers an error for the given Rule. |
List |
getErrors()
Returns this instance's list of validation errors. |
boolean |
isError()
Returns true if this instance contains one or more
validation errors. |
List |
removeAnonymousErrors()
Returns the validation errors that do not have an ID defined. |
List |
removeErrors()
Returns the validation errors that this instance holds. |
List |
removeErrorsFor(String id)
Returns the validation errors that this instance holds, and whose identifier starts with the given one. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Status(ValidationContext ctx)
| Method Detail |
|---|
public void error(Rule r)
r - a Rule.ValidationErr
public void error(Rule r,
String msg)
Rule. Internally
creates a ValidationException that is assigned
to a ValidationErr that is added to this instance's list
of ValidationErrs.
ValidationErr
public void error(Rule r,
Throwable err)
Rule. The Throwable
instance is is assigned to a ValidationErr that is added to this instance's list
of ValidationErrs.
ValidationErrpublic List getErrors()
List of ValidationErr.public boolean isError()
true if this instance contains one or more
validation errors.
true if this instance contains one or more
validation errors.public void addError(ValidationErr err)
err - a ValidationErrpublic void addErrors(List errs)
errs - a List of ValidationErrs.public List removeErrorsFor(String id)
List of ValidationErrs.public List removeErrors()
List of ValidationErrs.public List removeAnonymousErrors()
List of ValidationErrs.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||