This commit is contained in:
Keith Donald 2009-07-25 04:14:43 +00:00
parent 934d4a5fe0
commit 63336ff4a4
5 changed files with 18 additions and 8 deletions

View File

@ -30,13 +30,19 @@ public interface BindingResults extends Iterable<BindingResult> {
*/
BindingResults successes();
/**
* If there is at least one failed BindingResult.
* @see BindingResult#isFailure()
*/
boolean hasFailures();
/**
* The subset of BindingResults that failed.
*/
BindingResults failures();
/**
* The number of results.
* The total number of results.
*/
int size();

View File

@ -31,17 +31,17 @@ public class MissingFieldException extends RuntimeException {
private List<String> missing;
/**
* Creates a new missing source values exeption.
* Creates a new missing field exceptions.
* @param missing
* @param sourceValues
* @param fieldValues
*/
public MissingFieldException(List<String> missing, Map<String, ? extends Object> sourceValues) {
super(getMessage(missing, sourceValues));
public MissingFieldException(List<String> missing, Map<String, ? extends Object> fieldValues) {
super(getMessage(missing, fieldValues));
this.missing = missing;
}
/**
* The property paths for which source values were missing.
* The names of the fields that are missing.
*/
public List<String> getMissing() {
return missing;

View File

@ -56,6 +56,10 @@ class ArrayListBindingResults implements BindingResults {
return results;
}
public boolean hasFailures() {
return failures().size() > 0;
}
public BindingResults failures() {
ArrayListBindingResults results = new ArrayListBindingResults();
for (BindingResult result : this) {

View File

@ -52,7 +52,7 @@ class FieldNotEditableResult implements BindingResult {
public Alert getAlert() {
return new Alert() {
public String getCode() {
return "propertyNotWriteable";
return "fieldNotEditable";
}
public Severity getSeverity() {

View File

@ -52,7 +52,7 @@ class FieldNotFoundResult implements BindingResult {
public Alert getAlert() {
return new Alert() {
public String getCode() {
return "propertyNotFound";
return "fieldNotFound";
}
public Severity getSeverity() {