Skip to content

oyvindBjerke/checks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

checks

Maven dependency

<dependency>
    <groupId>no.obje</groupId>
    <artifactId>checks</artifactId>
    <version>0.2</version>
</dependency>

The purpose of this library

To create a utility library for null checking and similiar checks typically used when instantiating objects or injecting dependencies.

Example

Check constructor arguments to ensure that a valid object

public class Person {

    private final String name;
    private final List<String> occupations;
    
    public Person(String name, List<String> occupations) {
        this.name = Checks.notNull(name); // name is a required field
        this.occupations = Checks.notEmpty(occupations); // needs to have at least one occupation
    }

}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages