net.yetamine.checks

A set of utilities for compact runtime checks.

License

License

Categories

Categories

Net
GroupId

GroupId

net.yetamine
ArtifactId

ArtifactId

net.yetamine.checks
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

bundle
Description

Description

net.yetamine.checks
A set of utilities for compact runtime checks.
Project URL

Project URL

https://github.com/pdolezal/net.yetamine.checks
Project Organization

Project Organization

Yetamine
Source Code Management

Source Code Management

https://github.com/pdolezal/net.yetamine.checks.git

Download net.yetamine.checks

Dependencies

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.9.10

Project Modules

There are no modules declared in this project.

net.yetamine.checks

This repository provides a tiny Java library for compact runtime checks, especially for ensuring preconditions.

Examples

An example of a more advanced use of Argument::check:

public void foo(int i) {
    // Following check throws IllegalArgumentException if not satisfied with the detailed message
    bar(Argument.check(i, i > 0, () -> String.format("Requiring a positive number (given: %d).", i)));
}

private void bar(int i) {
    assert (i > 0);
    // Doing some stuff, requiring 'i' to be positive. But this method is private
    // and therefore it relies on the callers to provide already checked values.
}

Prerequisites

For building this project is needed:

  • JDK 8 or newer.
  • Maven 3.3 or newer.

For using the built library is needed:

  • JRE 8 or newer.

Licensing

The project is licensed under the Apache 2.0 license. For previous versions of this repository the original or current license can be chosen, i.e., the current license applies as an option for all previously published content.

Contributions to the project are welcome and accepted if they can be incorporated without the need of changing the license or license conditions and terms.

Yetamine logo

Versions

Version
1.1.0
1.0.2
1.0.1
1.0.0