Table of Contents
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.
- No need to write a redundant validation process for preconditions
- Tested and secure validation process
- Easy and intuitive operation
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;
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]);
}
}
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.
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!