org.templateproject.validator.support.ValidateResult Maven / Gradle / Ivy
The newest version!
package org.templateproject.validator.support;
import java.util.ArrayList;
import java.util.List;
/**
* Created by wuwenbin on 2017/6/28.
*/
public class ValidateResult {
private List checkResults;
private boolean hasError = false;
public List getCheckResults() {
return checkResults;
}
public void setCheckResults(List checkResults) {
this.checkResults = checkResults;
}
public boolean isHasError() {
return hasError;
}
public void setHasError(boolean hasError) {
this.hasError = hasError;
}
public List errors() {
List errorParams = new ArrayList<>(checkResults.size());
for (CheckResult checkResult : getCheckResults()) {
ErrorParam errorParam = new ErrorParam();
errorParam.setName(checkResult.getInvalidParamName());
errorParam.setValue(checkResult.getInvalidValue());
errorParam.setMessage(checkResult.getMessage());
errorParams.add(errorParam);
}
return errorParams;
}
public List errorNames() {
List errorNames = new ArrayList<>(checkResults.size());
for (CheckResult checkResult : getCheckResults()) {
errorNames.add(checkResult.getInvalidParamName());
}
return errorNames;
}
public List