The GAB Studios Validation Library for Java. The purpose of this project is to analyze and examine how I would create a validation library for Java. Comments are welcome. Thank you.
Release
<dependency>
<groupId>com.gabstudios</groupId>
<artifactId>gab-validate</artifactId>
<version>1.0.0</version>
</dependency>
Development
<dependency>
<groupId>com.gabstudios</groupId>
<artifactId>gab-validate</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
Use Maven to build - mvn package
.
This project requires the following:
* Java 8, 11
* Maven
In order to validate, you need to call a defineXXXXXX() method Validate.defineString("HelloWorld")
. Once that is done, you can perform tests by chain calling test methods.
Validate.defineString("HelloWorld").testMaxLength(10).throwValidationExceptionOnFail().validate();
boolean retVal = Validate.defineInteger(5000).testMaxValue(max).testMinValue(min).validate();
To validate a Boolean:
Validate.defineBoolean(name != null && name.length() > 0)
.testTrue()
.throwValidationExceptionOnFail()
.validate();
boolean retVal = Validate.defineBoolean(name != null && name.length() > 0)
.testTrue()
.validate();
To validate a String:
Validate.defineString("HelloWorld").testEqualsNoCase("hELLOwORLD")
.testMaxLength(10)
.throwValidationExceptionOnFail()
.validate();
boolean retVal = Validate.defineString("HelloWorld")
.testMaxLength(10)
.testEqualsNoCase("hELLOwORLD")
.validate();
Check the project wiki.
This codebase is licensed under the Apache v2.0 License.
Comments and feedback are greatly appreciated!!!