polish
This commit is contained in:
parent
934d4a5fe0
commit
63336ff4a4
|
|
@ -30,13 +30,19 @@ public interface BindingResults extends Iterable<BindingResult> {
|
||||||
*/
|
*/
|
||||||
BindingResults successes();
|
BindingResults successes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is at least one failed BindingResult.
|
||||||
|
* @see BindingResult#isFailure()
|
||||||
|
*/
|
||||||
|
boolean hasFailures();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The subset of BindingResults that failed.
|
* The subset of BindingResults that failed.
|
||||||
*/
|
*/
|
||||||
BindingResults failures();
|
BindingResults failures();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of results.
|
* The total number of results.
|
||||||
*/
|
*/
|
||||||
int size();
|
int size();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,17 +31,17 @@ public class MissingFieldException extends RuntimeException {
|
||||||
private List<String> missing;
|
private List<String> missing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new missing source values exeption.
|
* Creates a new missing field exceptions.
|
||||||
* @param missing
|
* @param missing
|
||||||
* @param sourceValues
|
* @param fieldValues
|
||||||
*/
|
*/
|
||||||
public MissingFieldException(List<String> missing, Map<String, ? extends Object> sourceValues) {
|
public MissingFieldException(List<String> missing, Map<String, ? extends Object> fieldValues) {
|
||||||
super(getMessage(missing, sourceValues));
|
super(getMessage(missing, fieldValues));
|
||||||
this.missing = missing;
|
this.missing = missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The property paths for which source values were missing.
|
* The names of the fields that are missing.
|
||||||
*/
|
*/
|
||||||
public List<String> getMissing() {
|
public List<String> getMissing() {
|
||||||
return missing;
|
return missing;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,10 @@ class ArrayListBindingResults implements BindingResults {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasFailures() {
|
||||||
|
return failures().size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public BindingResults failures() {
|
public BindingResults failures() {
|
||||||
ArrayListBindingResults results = new ArrayListBindingResults();
|
ArrayListBindingResults results = new ArrayListBindingResults();
|
||||||
for (BindingResult result : this) {
|
for (BindingResult result : this) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class FieldNotEditableResult implements BindingResult {
|
||||||
public Alert getAlert() {
|
public Alert getAlert() {
|
||||||
return new Alert() {
|
return new Alert() {
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "propertyNotWriteable";
|
return "fieldNotEditable";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Severity getSeverity() {
|
public Severity getSeverity() {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class FieldNotFoundResult implements BindingResult {
|
||||||
public Alert getAlert() {
|
public Alert getAlert() {
|
||||||
return new Alert() {
|
return new Alert() {
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "propertyNotFound";
|
return "fieldNotFound";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Severity getSeverity() {
|
public Severity getSeverity() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue