polish
This commit is contained in:
parent
934d4a5fe0
commit
63336ff4a4
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class FieldNotEditableResult implements BindingResult {
|
|||
public Alert getAlert() {
|
||||
return new Alert() {
|
||||
public String getCode() {
|
||||
return "propertyNotWriteable";
|
||||
return "fieldNotEditable";
|
||||
}
|
||||
|
||||
public Severity getSeverity() {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class FieldNotFoundResult implements BindingResult {
|
|||
public Alert getAlert() {
|
||||
return new Alert() {
|
||||
public String getCode() {
|
||||
return "propertyNotFound";
|
||||
return "fieldNotFound";
|
||||
}
|
||||
|
||||
public Severity getSeverity() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue