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 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", "
").replace("\tat", ""); // } // // return message; // } public Collection getErrors() { return this.errors; } }