Search in sources :

Example 1 with JavaxValidationOption

use of com.github.victools.jsonschema.module.javax.validation.JavaxValidationOption in project jsonschema-generator by victools.

the class SchemaGeneratorMojo method addJavaxValidationModule.

/**
 * Add the Javax Validation module to the generator config.
 *
 * @param configBuilder The builder on which the config is added
 * @param module The modules section form the pom
 * @throws MojoExecutionException in case of problems
 */
private void addJavaxValidationModule(SchemaGeneratorConfigBuilder configBuilder, GeneratorModule module) throws MojoExecutionException {
    if (module.options == null || module.options.length == 0) {
        configBuilder.with(new JavaxValidationModule());
    } else {
        JavaxValidationOption[] javaxValidationOptions = new JavaxValidationOption[module.options.length];
        for (int i = 0; i < module.options.length; i++) {
            try {
                javaxValidationOptions[i] = JavaxValidationOption.valueOf(module.options[i]);
            } catch (IllegalArgumentException e) {
                throw new MojoExecutionException("Error: Unknown JavaxValidation option " + module.options[i], e);
            }
        }
        configBuilder.with(new JavaxValidationModule(javaxValidationOptions));
    }
}
Also used : JavaxValidationOption(com.github.victools.jsonschema.module.javax.validation.JavaxValidationOption) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) JavaxValidationModule(com.github.victools.jsonschema.module.javax.validation.JavaxValidationModule)

Aggregations

JavaxValidationModule (com.github.victools.jsonschema.module.javax.validation.JavaxValidationModule)1 JavaxValidationOption (com.github.victools.jsonschema.module.javax.validation.JavaxValidationOption)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1