https://github.com/pdolezal/net.yetamine.checks
A small Java library for compact runtime checks
https://github.com/pdolezal/net.yetamine.checks
check java library
Last synced: 6 months ago
JSON representation
A small Java library for compact runtime checks
- Host: GitHub
- URL: https://github.com/pdolezal/net.yetamine.checks
- Owner: pdolezal
- Archived: true
- Created: 2015-12-20T16:45:07.000Z (over 10 years ago)
- Default Branch: version/1.x
- Last Pushed: 2017-01-29T22:21:43.000Z (over 9 years ago)
- Last Synced: 2023-07-07T16:40:16.816Z (almost 3 years ago)
- Topics: check, java, library
- Language: Java
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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`:
```{java}
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](http://www.apache.org/licenses/LICENSE-2.0). 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.
[](https://github.com/pdolezal/net.yetamine/blob/master/about/Yetamine_large.png)