SpringContracts - Design by Contract for Spring
After nearly one year of development, SpringContracts is out and now Open Source on SourceForge (http://springcontracts.sourceforge.net/home.html).
SpringContracts is a configurable Java solution for Design by Contract, which fits seamlessly into the Spring framework.
It allows the notation of Preconditions, Postconditions and Invariants to Interfaces and classes by Annotations.
For example, SpringContracts allows to configure (via ApplicationContext) which parts of a Contract (Pre-, Postcondition, Invariant) should be recognized at runtime and how to react, when Violations occur (exceptions, logging, ...).
Another pluggable Module is the language, used to describe the single constraints of Pre-, Postconditions and Invariants. While providing a default implementation, based on the Expression Language (Commons-EL) with Extensions for first order logic (all quator, exist quantor, implications), there will be the choice to use other Languages like MVEL, OGNL or another Scripting Language (for example Groovy or JRuby) as 'plug-ins' in the next future.
Some minor features include full support (recognition of Contract elements) for deep inheritance and multi-inheritance on interfaces, definition of messages in case of contract violations with reference to it's context (called class / method, args, return value) and usage of named constraints (configurable, global available (i.e. domain specific) constraints, which can be referenced and instantiated in a specific context within any Pre-, Postcondition, invariant by a symbolic name).
Next steps will bring support for MVEL and OGNL as constraint language, a ContractAttributeSource for defining Contracts in a reusable, declarative way in an ApplicationContext (as an alternative to Annotations) and a NameSpaceHandler for compact and easy configuration.
By now, you can fetch the sources and all unit tests from SourceForge. A more detailed Documentation and binaries will follow in the next days.
If you like to support further development or give any kind of comments - any kind of feedback is highly appreciated!