All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsonschema2pojo.GenerationConfig Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
/**
 * Copyright © 2010-2013 Nokia
 *
 * 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.
 */

package org.jsonschema2pojo;

import java.io.File;
import java.util.Iterator;

/**
 * Defines the configuration options for Java type generation, including source
 * and target paths/packages and all behavioural options (e.g should builders be
 * generated, should primitives be used, etc).
 * 

* Devs: add to this interface if you need to introduce a new config property. */ public interface GenerationConfig { /** * Gets the 'generateBuilders' configuration option. * * @return Whether to generate builder-style methods of the form * withXxx(value) (that return this), * alongside the standard, void-return setters. */ boolean isGenerateBuilders(); /** * Gets the 'usePrimitives' configuration option. * * @return whether to use primitives (long, double * , boolean) instead of wrapper types where possible * when generating bean properties (has the side-effect of making * those properties non-null). */ boolean isUsePrimitives(); /** * Gets the 'source' configuration option. * * @return The source file(s) or directory(ies) from which JSON Schema will * be read. */ Iterator getSource(); /** * Gets the 'targetDirectory' configuration option. * * @return The target directory into which generated types will be written * (may or may not exist before types are written) */ File getTargetDirectory(); /** * Gets the 'targetPackage' configuration option. * * @return The java package used for generated types. */ String getTargetPackage(); /** * Gets the 'propertyWordDelimiters' configuration option. * * @return an array of characters that should act as word delimiters when * choosing java bean property names. */ char[] getPropertyWordDelimiters(); /** * Gets the 'useLongIntegers' configuration option. * * @return Whether to use the java type long (or * {@link java.lang.Long}) instead of int (or * {@link java.lang.Integer}) when representing the JSON Schema type * 'integer'. */ boolean isUseLongIntegers(); /** * Gets the 'useDoubleNumbers' configuration option. * * @return Whether to use the java type double (or * {@link java.lang.Double}) instead of float (or * {@link java.lang.Float}) when representing the JSON Schema type * 'number'. */ boolean isUseDoubleNumbers(); /** * Gets the 'includeHashcodeAndEquals' configuration option. * * @return Whether to use include hashCode and * equals methods in generated Java types. */ boolean isIncludeHashcodeAndEquals(); /** * Gets the 'includeToString' configuration option. * * @return Whether to use include a toString method in * generated Java types. */ boolean isIncludeToString(); /** * Gets the 'annotationStyle' configuration option. * * @return The style of annotations to use in the generated Java types. *

* Supported values: *

    *
  • * jackson1 (apply annotations from the Jackson 1.x library)
  • *
  • * jackson2 (apply annotations from the Jackson * 2.x library)
  • *
  • * gson (apply annotations from the gson library)
  • *
  • * none (apply no annotations at all)
  • *
* @see AnnotatorFactory */ AnnotationStyle getAnnotationStyle(); /** * Gets the 'customAnnotator' configuration option. * * @return An annotator that will be used in addition to the one chosen by * {@link #getAnnotationStyle()} */ Class getCustomAnnotator(); /** * Gets the 'includeJsr303Annotations' configuration option. * * @return Whether to include JSR-303 * annotations (for schema rules like minimum, maximum, etc) in * generated Java types. */ boolean isIncludeJsr303Annotations(); /** * Gets the 'sourceType' configuration option. * * @return The type of input documents that will be read *

* Supported values: *

    *
  • jsonschema
  • *
  • json
  • *
*/ SourceType getSourceType(); /** * Gets the 'removeOldOutput' configuration option. * * @return Whether to empty the target directory before generation occurs, * to clear out all source files that have been generated * previously. Be warned, when activated this * option will cause jsonschema2pojo to indiscriminately * delete the entire contents of the target directory (all files and * folders) before it begins generating sources. */ boolean isRemoveOldOutput(); /** * Gets the 'outputEncoding' configuration option. * * @return The character encoding that should be used when writing the * generated Java source files. */ String getOutputEncoding(); /** * Gets the 'useJodaDates' configuration option. * * @return Whether to use {@link org.joda.time.DateTime} instead of * {@link java.util.Date} when adding date type fields to generated * Java types. */ boolean isUseJodaDates(); /** * Gets the 'useCommonsLang3' configuration option. * * @return Whether to use commons-lang 3.x imports instead of commons-lang * 2.x imports when adding equals, hashCode and toString methods. */ boolean isUseCommonsLang3(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy