Skip navigation links

Better Checks 1.0 API

The Better Checks library provides a lightweight and concise, but powerful way for precodition checking, in particular for method arguments.

See: Description

Packages 
Package Description
ch.trick17.betterchecks
Contains the main classes of the library, including Check, the primary entry point, and Config.
ch.trick17.betterchecks.fluent
Contains all fluent check classes, like IntCheck, StringCheck and many more.
ch.trick17.betterchecks.util
Utility classes.
The Better Checks library provides a lightweight and concise, but powerful way for precodition checking, in particular for method arguments. Argument checks are written in a fluent way like this:

Check.that(argument).check1().check2()...;

Examples:

Check.that(greeting).matches("hello .*!").hasLengthBetween(0, 20);
Check.that(list).isNullOr().hasSize(0);
Check.that(names).named("list of names").isNotEmpty();

The check methods, such as matches(...) or hasSize(...), throw an exception if the check fails. The exact type of exception depends on the kind of check that is called but in most cases it is IllegalArgumentException.

More documentation can be found in the Check class, the primary entry point to the library.

Author:
Michael Faes
Skip navigation links

Copyright © 2012–2017 Michael Faes. All rights reserved.