public class ValidationContext extends Object
would be used as follows:
public interface Validatable {
public static class ValidationContext { ... }
public boolean validate(ValidationContext vc);
}
public class Element implements Validatable { ... }
Then we could eventually reuse the context class and the accumulation
model in other places (attribute validation? metadata validation?).
In that case, we might want to make the 1st arg of addError
more generic (like 'Object relatedTo') or something.| Constructor and Description |
|---|
ValidationContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
addError(Element element,
ErrorContent error)
Add a validation error to list.
|
void |
addError(Element element,
String error)
Add an error by error string.
|
Map<Element,List<ErrorContent>> |
getErrors() |
boolean |
isValid() |
String |
toString() |
public Map<Element,List<ErrorContent>> getErrors()
public void addError(Element element, String error)
addError(Element, ErrorContent) should be used instead.public void addError(Element element, ErrorContent error)
element - element that was found to be invaliderror - error messagepublic boolean isValid()
Copyright © 2012. All Rights Reserved.