Search in sources :

Example 1 with JacksonOption

use of com.github.victools.jsonschema.module.jackson.JacksonOption in project jsonschema-generator by victools.

the class SchemaGeneratorMojo method addJacksonModule.

/**
 * Add the Jackson 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 Exception in case of error
 */
private void addJacksonModule(SchemaGeneratorConfigBuilder configBuilder, GeneratorModule module) throws MojoExecutionException {
    if (module.options == null || module.options.length == 0) {
        configBuilder.with(new JacksonModule());
    } else {
        JacksonOption[] jacksonOptions = new JacksonOption[module.options.length];
        for (int i = 0; i < module.options.length; i++) {
            try {
                jacksonOptions[i] = JacksonOption.valueOf(module.options[i]);
            } catch (IllegalArgumentException e) {
                throw new MojoExecutionException("Error: Unknown Jackson option " + module.options[i], e);
            }
        }
        configBuilder.with(new JacksonModule(jacksonOptions));
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) JacksonOption(com.github.victools.jsonschema.module.jackson.JacksonOption) JacksonModule(com.github.victools.jsonschema.module.jackson.JacksonModule)

Aggregations

JacksonModule (com.github.victools.jsonschema.module.jackson.JacksonModule)1 JacksonOption (com.github.victools.jsonschema.module.jackson.JacksonOption)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1