API
Using the Java API
openVALIDATION is mainly used as CLI in the console. However, it is possible to directly access the API of openVALIDATION for better integration in Java projects. For this purpose openVALIDATION provides a Maven package called openvalidation-core:
First you need an instance of the class org.bag.opernvalidation.core.OpenValidation
. This is instantiated as follows:
Parameters can now be initialized:
Now the code can be generated:
The object result of the type org.bag.openvalidation.common.model.OpenValidationResult
contains all information and results of the generation process. Among other things, the information whether errors occurred.
If there were no errors, then you can access the code results with the following calls:
The generated code always consists of two components. From the implemented rules and your own framework. The framework ensures that the generated code has no external dependencies.
This is how the code is accessed:
This is how the generated rules look like in Node.js or JavaScript:
Last updated