123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package com.boman.system.common;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import java.util.ArrayList;
- import java.util.Collection;
- /**
- * @author shiqian
- * @description
- * @date 2021年03月22日 10:50
- **/
- public class ValidationResults {
- private static final Logger log = LoggerFactory.getLogger(ValidationResults.class);
- private static ValidationResults okResult = new ValidationResults();
- private Collection<String> errors = new ArrayList();
- public ValidationResults() {
- }
- public static ValidationResults ok() {
- return okResult;
- }
- public boolean isOk() {
- return this.errors == null || this.errors.size() <= 0;
- }
- // public RowResult toRowResult(MainTableRecord row) {
- // return RowResult.error(String.join("\r\n", this.errors));
- // }
- // public void addError(Exception e) {
- // String message = getMessage(e);
- // this.errors.add(message);
- // }
- // private static String getMessage(Exception ex) {
- // String message = ex.getMessage();
- // if (!(ex instanceof NDSException)) {
- // StringWriter sw = new StringWriter();
- // PrintWriter pw = new PrintWriter(sw);
- // ex.printStackTrace(pw);
- // message = sw.toString().replace("\n", "<br/>").replace("\tat", "");
- // }
- //
- // return message;
- // }
- public Collection<String> getErrors() {
- return this.errors;
- }
- }
|