背景
为了实现接口响应全量字段断言,开发断言表达式框架时,除了调研常用的断言框架之外,也调研了一些验证框架和方法(非hibernate-validator、spring-validator验证注解)。
简单学习下构建工具Gradle如何使用。
commons-validator
A common issue when receiving data either electronically or from user input is verifying the integrity of the data. This work is repetitive and becomes even more complicated when different sets of validation rules need to be applied to the same set of data based on locale. Error messages may also vary by locale. This package addresses some of these issues to speed development and maintenance of validation rules.
Apache开源的通用验证框架,目前最新版本1.7。
hutool
A set of tools that keep Java sweet.
Hutool是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
Hutool 是项目中 “util” 包友好的替代,它节省了开发人员对项目中公用类和公用工具方法的封装时间,使开发专注于业务,同时可以最大限度的避免封装不完善带来的 bug。
验证方法比较
仅仅从验证方法比较:
验证测试工程(基于Gradle)
Gradle 配置文件
验证方法使用演示
?
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!