Java中的验证框架
我们目前正在重构我们的插件 API**(JDK 1.4 兼容)**,它以 jar 文件的形式发送给我们的客户(即,不需要生成 javascript 等等)).这是一个非常轻量级的插件,因此我们像 Spring 一样保留了尽可能多的依赖 jar.在此过程中,我们开始了解需要有一个适当的验证方法,该方法由一些验证框架提供支持.奇怪的是,除了 Commons Validator、Drools 和 Spring 支持等少数几个选项外,我在这些行中找不到太多选项(就像其他开源项目一样).
We are currently in the process of refactoring our plugin API**(JDK 1.4 compliant)** which is shipped to our clients in the form of a jar file(ie, no need to have javascripts to be generated and so forth). This is a very lightweight plugin so that we have kept away as many dependent jars as possible like Spring. During this process we started to understand the need to have a proper validation methodology which is faciliated by some validation Framework. Strangly, I couldnt find much options in these lines (like other open source projects)apart from a few such as Commons Validator,Drools and Spring support.
对于我的需求,Drools 似乎太复杂了.然而,Commons 验证器的验证方式看起来是史前的.
Drools seems to be so complex for my needs. However Commons validator looks prehistoric in its style of validation.
我不能使用基于注释的验证,因为它必须是 JDK 1.4,并且更喜欢可以外部化的东西,因此在发生变化时不需要再次编译类.
I cannot use annotation based validation cause it has to be JDK 1.4 and would prefer something that could be externalized thereby not requiring to compile classes again in case of changes.
有更好的选择吗?
推荐答案
XWork 验证系统在当时相当不错,但我已经快 3 年没有使用它了.我很确定它被设计为完全独立的,但也与 WebWork 的其余部分一起被整合到 Struts 2 中.信息在这里:
The XWork validation system was pretty decent back in the day but I haven't used it for almost 3 years now. I'm quite certain it was designed to be totally standalone but has also been rolled into Struts 2 along with the rest of WebWork. Info is here:
http://www.opensymphony.com/xwork/wikidocs/Validation%20Framework.html
相关文章