Java 验证框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/397852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java Validation Frameworks
提问by bowsie
I once came across a validation framework for java, where you wrote one method that protected the integrity of the data-type and any CRUD operations on that data-type automatically called this method.
我曾经遇到过一个 Java 验证框架,您在其中编写了一个方法来保护数据类型的完整性,并且对该数据类型的任何 CRUD 操作都会自动调用此方法。
Does anyone know what this framework is? I simply want to avoid repetitive validation on every CRUD method attached to a data-type.
有谁知道这个框架是什么?我只是想避免对附加到数据类型的每个 CRUD 方法进行重复验证。
采纳答案by Albert T. Wong
Here's a huge list of Java Validation Libraries / Frameworks - http://java-source.net/open-source/validation
这是 Java 验证库/框架的大量列表 - http://java-source.net/open-source/validation
回答by duffymo
Apache Commons has a validationframework.
Apache Commons 有一个验证框架。
回答by andref
Are you using Hibernate for persistence? If you are, there is Hibernate Validator.
您是否使用 Hibernate 进行持久化?如果是,则有Hibernate Validator。
回答by twelve17
Hibernate Validator, per adref's answer, is an implementation of JSR-303. Here's a helpful article to get you started if you are interested:
根据 adref 的回答,Hibernate Validator 是 JSR-303 的实现。如果您有兴趣,这里有一篇有用的文章可以帮助您入门: