|
| 1 | +/* |
| 2 | + * Regula Document Reader Web API |
| 3 | + * Documents recognition as easy as reading two bytes. # Clients: * [JavaScript](https://github.com/regulaforensics/DocumentReader-web-js-client) client for the browser and node.js based on axios * [Java](https://github.com/regulaforensics/DocumentReader-web-java-client) client compatible with jvm and android * [Python](https://github.com/regulaforensics/DocumentReader-web-python-client) 3.5+ client * [C#](https://github.com/regulaforensics/DocumentReader-web-csharp-client) client for .NET & .NET Core |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: 8.1.0 |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 9 | + * https://openapi-generator.tech |
| 10 | + * Do not edit the class manually. |
| 11 | + */ |
| 12 | + |
| 13 | +package com.regula.documentreader.webclient.model; |
| 14 | + |
| 15 | +import com.google.gson.Gson; |
| 16 | +import com.google.gson.JsonElement; |
| 17 | +import com.google.gson.JsonObject; |
| 18 | +import com.google.gson.TypeAdapter; |
| 19 | +import com.google.gson.TypeAdapterFactory; |
| 20 | +import com.google.gson.annotations.SerializedName; |
| 21 | +import com.google.gson.reflect.TypeToken; |
| 22 | +import com.google.gson.stream.JsonReader; |
| 23 | +import com.google.gson.stream.JsonWriter; |
| 24 | +import com.regula.documentreader.webclient.JSON; |
| 25 | +import java.io.IOException; |
| 26 | +import java.util.Arrays; |
| 27 | +import java.util.HashSet; |
| 28 | +import java.util.Objects; |
| 29 | + |
| 30 | +/** GlaresCheckParams */ |
| 31 | +@javax.annotation.Generated( |
| 32 | + value = "org.openapitools.codegen.languages.JavaClientCodegen", |
| 33 | + comments = "Generator version: 7.15.0") |
| 34 | +public class GlaresCheckParams { |
| 35 | + public static final String SERIALIZED_NAME_IMG_MARGIN_PART = "imgMarginPart"; |
| 36 | + |
| 37 | + @SerializedName(SERIALIZED_NAME_IMG_MARGIN_PART) |
| 38 | + @javax.annotation.Nullable |
| 39 | + private Float imgMarginPart; |
| 40 | + |
| 41 | + public static final String SERIALIZED_NAME_MAX_GLARING_PART = "maxGlaringPart"; |
| 42 | + |
| 43 | + @SerializedName(SERIALIZED_NAME_MAX_GLARING_PART) |
| 44 | + @javax.annotation.Nullable |
| 45 | + private Float maxGlaringPart; |
| 46 | + |
| 47 | + public GlaresCheckParams() {} |
| 48 | + |
| 49 | + public GlaresCheckParams imgMarginPart(@javax.annotation.Nullable Float imgMarginPart) { |
| 50 | + this.imgMarginPart = imgMarginPart; |
| 51 | + return this; |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Margin from the edges of the image. 0.35 = 35% |
| 56 | + * |
| 57 | + * @return imgMarginPart |
| 58 | + */ |
| 59 | + @javax.annotation.Nullable |
| 60 | + public Float getImgMarginPart() { |
| 61 | + return imgMarginPart; |
| 62 | + } |
| 63 | + |
| 64 | + public void setImgMarginPart(@javax.annotation.Nullable Float imgMarginPart) { |
| 65 | + this.imgMarginPart = imgMarginPart; |
| 66 | + } |
| 67 | + |
| 68 | + public GlaresCheckParams maxGlaringPart(@javax.annotation.Nullable Float maxGlaringPart) { |
| 69 | + this.maxGlaringPart = maxGlaringPart; |
| 70 | + return this; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * The maximum allowable part of the area occupied by the glare. The same: 0.06 = 6% |
| 75 | + * |
| 76 | + * @return maxGlaringPart |
| 77 | + */ |
| 78 | + @javax.annotation.Nullable |
| 79 | + public Float getMaxGlaringPart() { |
| 80 | + return maxGlaringPart; |
| 81 | + } |
| 82 | + |
| 83 | + public void setMaxGlaringPart(@javax.annotation.Nullable Float maxGlaringPart) { |
| 84 | + this.maxGlaringPart = maxGlaringPart; |
| 85 | + } |
| 86 | + |
| 87 | + @Override |
| 88 | + public boolean equals(Object o) { |
| 89 | + if (this == o) { |
| 90 | + return true; |
| 91 | + } |
| 92 | + if (o == null || getClass() != o.getClass()) { |
| 93 | + return false; |
| 94 | + } |
| 95 | + GlaresCheckParams glaresCheckParams = (GlaresCheckParams) o; |
| 96 | + return Objects.equals(this.imgMarginPart, glaresCheckParams.imgMarginPart) |
| 97 | + && Objects.equals(this.maxGlaringPart, glaresCheckParams.maxGlaringPart); |
| 98 | + } |
| 99 | + |
| 100 | + @Override |
| 101 | + public int hashCode() { |
| 102 | + return Objects.hash(imgMarginPart, maxGlaringPart); |
| 103 | + } |
| 104 | + |
| 105 | + @Override |
| 106 | + public String toString() { |
| 107 | + StringBuilder sb = new StringBuilder(); |
| 108 | + sb.append("class GlaresCheckParams {\n"); |
| 109 | + sb.append(" imgMarginPart: ").append(toIndentedString(imgMarginPart)).append("\n"); |
| 110 | + sb.append(" maxGlaringPart: ").append(toIndentedString(maxGlaringPart)).append("\n"); |
| 111 | + sb.append("}"); |
| 112 | + return sb.toString(); |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 117 | + */ |
| 118 | + private String toIndentedString(Object o) { |
| 119 | + if (o == null) { |
| 120 | + return "null"; |
| 121 | + } |
| 122 | + return o.toString().replace("\n", "\n "); |
| 123 | + } |
| 124 | + |
| 125 | + public static HashSet<String> openapiFields; |
| 126 | + public static HashSet<String> openapiRequiredFields; |
| 127 | + |
| 128 | + static { |
| 129 | + // a set of all properties/fields (JSON key names) |
| 130 | + openapiFields = new HashSet<String>(Arrays.asList("imgMarginPart", "maxGlaringPart")); |
| 131 | + |
| 132 | + // a set of required properties/fields (JSON key names) |
| 133 | + openapiRequiredFields = new HashSet<String>(0); |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * Validates the JSON Element and throws an exception if issues found |
| 138 | + * |
| 139 | + * @param jsonElement JSON Element |
| 140 | + * @throws IOException if the JSON Element is invalid with respect to GlaresCheckParams |
| 141 | + */ |
| 142 | + public static void validateJsonElement(JsonElement jsonElement) throws IOException { |
| 143 | + if (jsonElement == null) { |
| 144 | + if (!GlaresCheckParams.openapiRequiredFields |
| 145 | + .isEmpty()) { // has required fields but JSON element is null |
| 146 | + System.err.println( |
| 147 | + String.format( |
| 148 | + "The required field(s) %s in GlaresCheckParams is not found in the empty JSON string", |
| 149 | + GlaresCheckParams.openapiRequiredFields.toString())); |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + JsonObject jsonObj = jsonElement.getAsJsonObject(); |
| 154 | + } |
| 155 | + |
| 156 | + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { |
| 157 | + @SuppressWarnings("unchecked") |
| 158 | + @Override |
| 159 | + public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { |
| 160 | + if (!GlaresCheckParams.class.isAssignableFrom(type.getRawType())) { |
| 161 | + return null; // this class only serializes 'GlaresCheckParams' and its subtypes |
| 162 | + } |
| 163 | + final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); |
| 164 | + final TypeAdapter<GlaresCheckParams> thisAdapter = |
| 165 | + gson.getDelegateAdapter(this, TypeToken.get(GlaresCheckParams.class)); |
| 166 | + |
| 167 | + return (TypeAdapter<T>) |
| 168 | + new TypeAdapter<GlaresCheckParams>() { |
| 169 | + @Override |
| 170 | + public void write(JsonWriter out, GlaresCheckParams value) throws IOException { |
| 171 | + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); |
| 172 | + elementAdapter.write(out, obj); |
| 173 | + } |
| 174 | + |
| 175 | + @Override |
| 176 | + public GlaresCheckParams read(JsonReader in) throws IOException { |
| 177 | + JsonElement jsonElement = elementAdapter.read(in); |
| 178 | + validateJsonElement(jsonElement); |
| 179 | + return thisAdapter.fromJsonTree(jsonElement); |
| 180 | + } |
| 181 | + }.nullSafe(); |
| 182 | + } |
| 183 | + } |
| 184 | + |
| 185 | + /** |
| 186 | + * Create an instance of GlaresCheckParams given an JSON string |
| 187 | + * |
| 188 | + * @param jsonString JSON string |
| 189 | + * @return An instance of GlaresCheckParams |
| 190 | + * @throws IOException if the JSON string is invalid with respect to GlaresCheckParams |
| 191 | + */ |
| 192 | + public static GlaresCheckParams fromJson(String jsonString) throws IOException { |
| 193 | + return JSON.getGson().fromJson(jsonString, GlaresCheckParams.class); |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * Convert an instance of GlaresCheckParams to an JSON string |
| 198 | + * |
| 199 | + * @return JSON string |
| 200 | + */ |
| 201 | + public String toJson() { |
| 202 | + return JSON.getGson().toJson(this); |
| 203 | + } |
| 204 | +} |
0 commit comments