This project contains a set of contracts for design by contract. The contracts follow the following naming scheme:
- Methods starting with require are preconditions, which are used to check arguments
- Methods starting with check are state checks or invariants, which are used to check intermediate results for consistency
- Methods starting with ensure are postconditions, which are used to check results before returning them
The (static) methods implementing different contracts are grouped in the following classes:
BaseContracts
to test for nullability and simple boolean conditions.CollectionContracts
to test collections for nullability and emptiness.StringContracts
to test strings for emptiness and blankness (and nullability).
Releases can be found in Maven central under the following coordinates:
<dependency>
<groupId>de.wps.common</groupId>
<artifactId>common-contracts</artifactId>
<version>0.8</version>
</dependency>
If you do not want to get the (only) transitive dependency org.checkerframework:check-qual
, you can exclude it:
<dependency>
<groupId>de.wps.common</groupId>
<artifactId>common-contracts</artifactId>
<version>0.8</version>
<exclusions>
<exclusion>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</exclusion>
</exclusions>
</dependency>