一个很好的Java合同设计库? [英] A good Design-by-Contract library for Java?

查看:177
本文介绍了一个很好的Java合同设计库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年前,我做了一个关于Java的DbC包的调查,我对它们中的任何一个都不满意。不幸的是,我没有对我的发现做好记录,我认为事情已经发生了变化。有人会关心比较和对比不同的Java DbC包吗?

A few years ago, I did a survey of DbC packages for Java, and I wasn't wholly satisfied with any of them. Unfortunately I didn't keep good notes on my findings, and I assume things have changed. Would anybody care to compare and contrast different DbC packages for Java?

推荐答案

有一个很好的概述
WikiPedia关于按合同设计,最后有一节关于带有第三方支持库的语言,其中包括一系列优秀的Java库。大多数Java库都基于Java Assertions。

There is a nice overview on WikiPedia about Design by Contract, at the end there is a section regarding languages with third party support libraries, which includes a nice serie of Java libraries. Most of these Java libraries are based on Java Assertions.

如果你只需要预处理检查还有一个轻量级的验证方法参数解决方案,位于SourceForge下 Java Argument Validation (简单Java实现)。

In the case you only need Precondition Checking there is also a lightweight Validate Method Arguments solution, at SourceForge under Java Argument Validation (Plain Java implementation).

根据您的问题,可能是 OVal 框架,用于字段/属性约束验证是一个不错的选择。此框架允许您将约束放置在各种不同的形式(注释,POJO,XML)中。通过POJO或脚本语言(JavaScript,Groovy,BeanShell,OGNL,MVEL)创建客户约束。并且它还实施了合同编程

Depending on your problem, maybe the OVal framework, for field/property Constraints validation is a good choice. This framework lets you place the Constraints in all kind of different forms (Annotations, POJO, XML). Create customer constraints through POJO or scripting languages (JavaScript, Groovy, BeanShell, OGNL, MVEL). And it also party implements Programming by Contract.

这篇关于一个很好的Java合同设计库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆