|
| 1 | +plugins { |
| 2 | + id 'com.android.application' |
| 3 | + id "org.jsonschema2dataclass" |
| 4 | +} |
| 5 | + |
| 6 | +android { |
| 7 | + compileSdkVersion 30 |
| 8 | + |
| 9 | + defaultConfig { |
| 10 | + applicationId "org.jsonschema2dataclass.android" |
| 11 | + minSdkVersion 17 |
| 12 | + targetSdkVersion 30 |
| 13 | + versionCode 1 |
| 14 | + versionName "1.0" |
| 15 | + } |
| 16 | + buildTypes { |
| 17 | + release { |
| 18 | + minifyEnabled false |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + packagingOptions { |
| 23 | + exclude 'META-INF/LICENSE.txt' |
| 24 | + } |
| 25 | + |
| 26 | + compileOptions { |
| 27 | + sourceCompatibility 1.8 |
| 28 | + targetCompatibility 1.8 |
| 29 | + } |
| 30 | + |
| 31 | + sourceSets { |
| 32 | + main { |
| 33 | + manifest.srcFile '../../android/app/src/main/AndroidManifest.xml' |
| 34 | + java.srcDirs = ['../../android/app/src/main/java'] |
| 35 | + resources.srcDirs = ['../../android/app/src/main/resources'] |
| 36 | + res.srcDirs = ['../../android/app/src/main/res'] |
| 37 | + } |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +dependencies { |
| 42 | + implementation 'androidx.appcompat:appcompat:1.2.0' |
| 43 | + |
| 44 | + // Required for @Generated annotation |
| 45 | + implementation 'org.glassfish:javax.annotation:10.0-b28' |
| 46 | + implementation 'com.google.code.gson:gson:2.8.6' |
| 47 | + implementation 'com.squareup.moshi:moshi:1.11.0' |
| 48 | + // Required if generating JSR-303 annotations |
| 49 | + implementation 'javax.validation:validation-api:2.0.1.Final' |
| 50 | + implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.2' |
| 51 | + |
| 52 | +} |
| 53 | + |
| 54 | +// Each configuration is set to the default value |
| 55 | +jsonSchema2Pojo { |
| 56 | + // Whether to generate builder-style methods of the form withXxx(value) (that return this), |
| 57 | + // alongside the standard, void-return setters. |
| 58 | + generateBuilders = false |
| 59 | + |
| 60 | + // Whether to use primitives (long, double, boolean) instead of wrapper types where possible |
| 61 | + // when generating bean properties (has the side-effect of making those properties non-null). |
| 62 | + usePrimitives = false |
| 63 | + |
| 64 | + // Location of the JSON Schema file(s). This may refer to a single file or a directory of files. |
| 65 | + //source = files("${sourceSets.main.output.resourcesDir}/json") |
| 66 | + source.setFrom files("${project.rootDir}/schema") |
| 67 | + |
| 68 | + // Target directory for generated Java source files. The plugin will ignore this value for Android projects and will generate the classes into a generated source folder for each build variant and add this directory to the |
| 69 | + // java source set so the compiler will find and compile the newly generated source files. |
| 70 | + // targetDirectory = file("${project.rootDir}/build/generated-sources/js2p") |
| 71 | + |
| 72 | + // Package name used for generated Java classes (for types where a fully qualified name has not |
| 73 | + // been supplied in the schema using the 'javaType' property). |
| 74 | + targetPackage = 'com.oosocial.clarityn.rest.clarityn.model' |
| 75 | + |
| 76 | + // The characters that should be considered as word delimiters when creating Java Bean property |
| 77 | + // names from JSON property names. If blank or not set, JSON properties will be considered to |
| 78 | + // contain a single word when creating Java Bean property names. |
| 79 | + propertyWordDelimiters = '' |
| 80 | + |
| 81 | + // Whether to use the java type long (or Long) instead of int (or Integer) when representing the |
| 82 | + // JSON Schema type 'integer'. |
| 83 | + useLongIntegers = false |
| 84 | + |
| 85 | + // Whether to use the java type double (or Double) instead of float (or Float) when representing |
| 86 | + // the JSON Schema type 'number'. |
| 87 | + useDoubleNumbers = true |
| 88 | + |
| 89 | + // Whether to include hashCode and equals methods in generated Java types. |
| 90 | + includeHashcodeAndEquals = true |
| 91 | + |
| 92 | + // Whether to include a toString method in generated Java types. |
| 93 | + includeToString = true |
| 94 | + |
| 95 | + // The style of annotations to use in the generated Java types. Supported values: |
| 96 | + // - jackson (alias of jackson2) |
| 97 | + // - jackson2 (apply annotations from the Jackson 2.x library) |
| 98 | + // - gson (apply annotations from the Gson library) |
| 99 | + // - moshi1 (apply annotations from the Moshi 1.x library) |
| 100 | + // - none (apply no annotations at all) |
| 101 | + annotationStyle = 'gson' |
| 102 | + |
| 103 | + // A fully qualified class name, referring to a custom annotator class that implements |
| 104 | + // by annotationStyle. If you want to use the custom annotator alone, set annotationStyle to none. |
| 105 | + customAnnotator = 'org.jsonschema2pojo.NoopAnnotator' |
| 106 | + |
| 107 | + // Whether to include JSR-303/349 annotations (for schema rules like minimum, maximum, etc) in |
| 108 | + // generated Java types. Schema rules and the annotation they produce: |
| 109 | + // - maximum = @DecimalMax |
| 110 | + // - minimum = @DecimalMin |
| 111 | + // - minItems,maxItems = @Size |
| 112 | + // - minLength,maxLength = @Size |
| 113 | + // - pattern = @Pattern |
| 114 | + // - required = @NotNull |
| 115 | + // Any Java fields which are an object or array of objects will be annotated with @Valid to |
| 116 | + // support validation of an entire document tree. |
| 117 | + includeJsr303Annotations = true |
| 118 | + |
| 119 | + // The type of input documents that will be read. Supported values: |
| 120 | + // - jsonschema (schema documents, containing formal rules that describe the structure of json data) |
| 121 | + // - json (documents that represent an example of the kind of json data that the generated Java types |
| 122 | + // will be mapped to) |
| 123 | + sourceType = 'jsonschema' |
| 124 | + |
| 125 | + // Whether to empty the target directory before generation occurs, to clear out all source files |
| 126 | + // that have been generated previously. <strong>Be warned</strong>, when activated this option |
| 127 | + // will cause jsonschema2pojo to <strong>indiscriminately delete the entire contents of the target |
| 128 | + // directory (all files and folders)</strong> before it begins generating sources. |
| 129 | + removeOldOutput = true |
| 130 | + |
| 131 | + // The character encoding that should be used when writing the generated Java source files |
| 132 | + outputEncoding = 'UTF-8' |
| 133 | + |
| 134 | + // Whether to use {@link org.joda.time.DateTime} instead of {@link java.util.Date} when adding |
| 135 | + // date type fields to generated Java types. |
| 136 | + useJodaDates = false |
| 137 | + |
| 138 | + // Whether to initialize Set and List fields as empty collections, or leave them as null. |
| 139 | + initializeCollections = true |
| 140 | + // Include @Generated annotation |
| 141 | + includeGeneratedAnnotation = true |
| 142 | +} |
0 commit comments