JValidations -


未知
跨平台
Java

软件简介

JValidations 是一个 Java 对象的数据验证框架。

示例代码:

public class Customer implements Validatable<ValidationReport>{  
                private String name;  
                private String email;

                public void buildValidation(ValidationSyntax validates, ValidationReport report) {  
                    validates.that("name", not(isEmptyString()), _else(report,"isBlank", fieldName()));  
                    validates.that("email", not(isEmptyString()), _else(report,"isBlank", fieldName()));  
                }

                public interface ValidationReport {  
                    void isBlank(String fieldName);  
                }  
}