myConsciousness / precondition-validator

The Precondition Validator provides a variety of easy and intuitive validation functions. The features in this package will free you from simple and redundant checking processes.

Home Page:https://myconsciousness.github.io/precondition-validator/org/thinkit/common/Preconditions.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Latest Version License
Java CI with Gradle

1. Precondition Validator

Table of Contents

1.1. What is it?

Make your software more robust by defining clear preconditions!

Precondition Validator provides several features to ensure that the parameters and data passed at the start of the process meet the preconditions.

Using the Precondition Validator features, you can safely and easily specify preconditions at the start of the process.

1.2. Benefits

  • No need to write a redundant validation process for preconditions
  • Tested and secure validation process
  • Easy and intuitive operation

1.3. How To Use

1.3.1. Add the dependencies

Note:
Replace version you want to use. Check the latest Packages.
Please contact me for a token to download the package.

Maven

<dependency>
  <groupId>org.thinkit.common</groupId>
  <artifactId>precondition-validator</artifactId>
  <version>v1.1.1</version>
</dependency>

<servers>
  <server>
    <id>github</id>
    <username>myConsciousness</username>
    <password>xxxxxxxxxxxxxxxxxx</password>
  </server>
</servers>

Gradle

repositories {
    maven {
        name = "GitHubPackages"
        url = uri("https://maven.pkg.github.com/myConsciousness/precondition-validator")
        credentials {
          username = "myConsciousness"
          password = "xxxxxxxxxxxxxxxxxx"
        }
    }
}

dependencies {
    implementation 'org.thinkit.common:precondition-validator:v1.1.1'
}

1.3.2. Add an import for Preconditions

import org.thinkit.common.base.precondition.Preconditions;

1.3.3. Define preconditions

The following is an example using Preconditions#requireNonEmpty(Object[]) and Preconditions#requireNonEmpty(String).

Note:
The reference for all validation methods is here.

import org.thinkit.common.base.precondition.Preconditions;

public class DemoPreconditions {

     /**
      * Entry point for app that are expected to be given a non-empty string...
      */
     public static void main(String[] args) {
          // Validate that args is not an empty array
          // and that args[0] is not an empty string.
          Preconditions.requireNonEmpty(args);
          Preconditions.requireNonEmpty(args[0]);
     }
}

1.4. License

Copyright 2020 Kato Shinya.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.

1.5. More Information

Precondition Validator was designed and implemented by Kato Shinya, who works as a freelance developer.

Regardless of the means or content of communication, I would love to hear from you if you have any questions or concerns. I do not check my email box very often so a response may be delayed, anyway thank you for your interest!

About

The Precondition Validator provides a variety of easy and intuitive validation functions. The features in this package will free you from simple and redundant checking processes.

https://myconsciousness.github.io/precondition-validator/org/thinkit/common/Preconditions.html

License:Apache License 2.0


Languages

Language:Java 100.0%