|
| 1 | +/* |
| 2 | + * -------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose" file="JsonDataLoadOptions.java"> |
| 4 | + * Copyright (c) 2021 Aspose.Words for Cloud |
| 5 | + * </copyright> |
| 6 | + * <summary> |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
| 9 | + * in the Software without restriction, including without limitation the rights |
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be included in all |
| 15 | + * copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | + * SOFTWARE. |
| 24 | + * </summary> |
| 25 | + * -------------------------------------------------------------------------------- |
| 26 | + */ |
| 27 | + |
| 28 | +package com.aspose.words.cloud.model; |
| 29 | + |
| 30 | +import java.util.Objects; |
| 31 | +import java.util.Arrays; |
| 32 | +import java.util.ArrayList; |
| 33 | +import java.util.List; |
| 34 | +import java.io.IOException; |
| 35 | +import org.threeten.bp.OffsetDateTime; |
| 36 | +import com.aspose.words.cloud.model.*; |
| 37 | +import com.google.gson.TypeAdapter; |
| 38 | +import com.google.gson.annotations.JsonAdapter; |
| 39 | +import com.google.gson.annotations.SerializedName; |
| 40 | +import com.google.gson.stream.JsonReader; |
| 41 | +import com.google.gson.stream.JsonWriter; |
| 42 | +import io.swagger.annotations.ApiModel; |
| 43 | +import io.swagger.annotations.ApiModelProperty; |
| 44 | + |
| 45 | +/** |
| 46 | + * Represents options for parsing JSON data. |
| 47 | + */ |
| 48 | +@ApiModel(description = "Represents options for parsing JSON data.") |
| 49 | +public class JsonDataLoadOptions { |
| 50 | + /** |
| 51 | + * Gets or sets a mode for parsing JSON simple values (null, boolean, number, integer, |
| 52 | + * and string) while loading JSON. Such a mode does not affect parsing of date-time |
| 53 | + * values. The default is Aspose.Words.Reporting.JsonSimpleValueParseMode.Loose. |
| 54 | + */ |
| 55 | + @JsonAdapter(SimpleValueParseModeEnum.Adapter.class) |
| 56 | + public enum SimpleValueParseModeEnum { |
| 57 | + LOOSE("Loose"), |
| 58 | + STRICT("Strict"); |
| 59 | + |
| 60 | + private String value; |
| 61 | + |
| 62 | + SimpleValueParseModeEnum(String value) { |
| 63 | + this.value = value; |
| 64 | + } |
| 65 | + |
| 66 | + public String getValue() { |
| 67 | + return value; |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public String toString() { |
| 72 | + return String.valueOf(value); |
| 73 | + } |
| 74 | + |
| 75 | + public static SimpleValueParseModeEnum fromValue(String text) { |
| 76 | + for (SimpleValueParseModeEnum b : SimpleValueParseModeEnum.values()) { |
| 77 | + if (String.valueOf(b.value).equals(text)) { |
| 78 | + return b; |
| 79 | + } |
| 80 | + } |
| 81 | + return null; |
| 82 | + } |
| 83 | + |
| 84 | + public static class Adapter extends TypeAdapter< SimpleValueParseModeEnum > { |
| 85 | + @Override |
| 86 | + public void write(final JsonWriter jsonWriter, final SimpleValueParseModeEnum enumeration) throws IOException { |
| 87 | + jsonWriter.value(enumeration.getValue()); |
| 88 | + } |
| 89 | + |
| 90 | + @Override |
| 91 | + public SimpleValueParseModeEnum read(final JsonReader jsonReader) throws IOException { |
| 92 | + String value = jsonReader.nextString(); |
| 93 | + return SimpleValueParseModeEnum.fromValue(String.valueOf(value)); |
| 94 | + } |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + @SerializedName("AlwaysGenerateRootObject") |
| 99 | + private Boolean alwaysGenerateRootObject = null; |
| 100 | + |
| 101 | + @SerializedName("ExactDateTimeParseFormats") |
| 102 | + private List<String> exactDateTimeParseFormats = null; |
| 103 | + |
| 104 | + @SerializedName("SimpleValueParseMode") |
| 105 | + private SimpleValueParseModeEnum simpleValueParseMode = null; |
| 106 | + public JsonDataLoadOptions alwaysGenerateRootObject(Boolean alwaysGenerateRootObject) { |
| 107 | + this.alwaysGenerateRootObject = alwaysGenerateRootObject; |
| 108 | + return this; |
| 109 | + } |
| 110 | + |
| 111 | + /** |
| 112 | + * Gets or sets a value indicating whether a generated data source will always contain |
| 113 | + * an object for a JSON root element. If a JSON root element contains a single complex |
| 114 | + * property, such an object is not created by default. |
| 115 | + * @return alwaysGenerateRootObject |
| 116 | + **/ |
| 117 | + @ApiModelProperty(value = "Gets or sets a value indicating whether a generated data source will always contain an object for a JSON root element. If a JSON root element contains a single complex property, such an object is not created by default.") |
| 118 | + public Boolean getAlwaysGenerateRootObject() { |
| 119 | + return alwaysGenerateRootObject; |
| 120 | + } |
| 121 | + |
| 122 | + public void setAlwaysGenerateRootObject(Boolean alwaysGenerateRootObject) { |
| 123 | + this.alwaysGenerateRootObject = alwaysGenerateRootObject; |
| 124 | + } |
| 125 | + |
| 126 | + public JsonDataLoadOptions exactDateTimeParseFormats(List<String> exactDateTimeParseFormats) { |
| 127 | + this.exactDateTimeParseFormats = exactDateTimeParseFormats; |
| 128 | + return this; |
| 129 | + } |
| 130 | + |
| 131 | + public JsonDataLoadOptions addExactDateTimeParseFormatsItem(String exactDateTimeParseFormatsItem) { |
| 132 | + if (this.exactDateTimeParseFormats == null) { |
| 133 | + this.exactDateTimeParseFormats = new ArrayList<String>(); |
| 134 | + } |
| 135 | + this.exactDateTimeParseFormats.add(exactDateTimeParseFormatsItem); |
| 136 | + return this; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * Gets or sets exact formats for parsing JSON date-time values while loading JSON. |
| 141 | + * The default is null. |
| 142 | + * @return exactDateTimeParseFormats |
| 143 | + **/ |
| 144 | + @ApiModelProperty(value = "Gets or sets exact formats for parsing JSON date-time values while loading JSON. The default is null.") |
| 145 | + public List<String> getExactDateTimeParseFormats() { |
| 146 | + return exactDateTimeParseFormats; |
| 147 | + } |
| 148 | + |
| 149 | + public void setExactDateTimeParseFormats(List<String> exactDateTimeParseFormats) { |
| 150 | + this.exactDateTimeParseFormats = exactDateTimeParseFormats; |
| 151 | + } |
| 152 | + |
| 153 | + public JsonDataLoadOptions simpleValueParseMode(SimpleValueParseModeEnum simpleValueParseMode) { |
| 154 | + this.simpleValueParseMode = simpleValueParseMode; |
| 155 | + return this; |
| 156 | + } |
| 157 | + |
| 158 | + /** |
| 159 | + * Gets or sets a mode for parsing JSON simple values (null, boolean, number, integer, |
| 160 | + * and string) while loading JSON. Such a mode does not affect parsing of date-time |
| 161 | + * values. The default is Aspose.Words.Reporting.JsonSimpleValueParseMode.Loose. |
| 162 | + * @return simpleValueParseMode |
| 163 | + **/ |
| 164 | + @ApiModelProperty(value = "Gets or sets a mode for parsing JSON simple values (null, boolean, number, integer, and string) while loading JSON. Such a mode does not affect parsing of date-time values. The default is Aspose.Words.Reporting.JsonSimpleValueParseMode.Loose.") |
| 165 | + public SimpleValueParseModeEnum getSimpleValueParseMode() { |
| 166 | + return simpleValueParseMode; |
| 167 | + } |
| 168 | + |
| 169 | + public void setSimpleValueParseMode(SimpleValueParseModeEnum simpleValueParseMode) { |
| 170 | + this.simpleValueParseMode = simpleValueParseMode; |
| 171 | + } |
| 172 | + |
| 173 | + @Override |
| 174 | + public boolean equals(java.lang.Object o) { |
| 175 | + if (this == o) { |
| 176 | + return true; |
| 177 | + } |
| 178 | + if (o == null || getClass() != o.getClass()) { |
| 179 | + return false; |
| 180 | + } |
| 181 | + |
| 182 | + JsonDataLoadOptions jsonDataLoadOptions = (JsonDataLoadOptions) o; |
| 183 | + return |
| 184 | + Objects.equals(this.alwaysGenerateRootObject, jsonDataLoadOptions.alwaysGenerateRootObject) && |
| 185 | + Objects.equals(this.exactDateTimeParseFormats, jsonDataLoadOptions.exactDateTimeParseFormats) && |
| 186 | + Objects.equals(this.simpleValueParseMode, jsonDataLoadOptions.simpleValueParseMode); |
| 187 | + } |
| 188 | + |
| 189 | + @Override |
| 190 | + public int hashCode() { |
| 191 | + return Objects.hash(alwaysGenerateRootObject, exactDateTimeParseFormats, simpleValueParseMode); |
| 192 | + } |
| 193 | + |
| 194 | + @Override |
| 195 | + public String toString() { |
| 196 | + StringBuilder sb = new StringBuilder(); |
| 197 | + sb.append("class JsonDataLoadOptions {\n"); |
| 198 | + sb.append(" alwaysGenerateRootObject: ").append(toIndentedString(alwaysGenerateRootObject)).append("\n"); |
| 199 | + sb.append(" exactDateTimeParseFormats: ").append(toIndentedString(exactDateTimeParseFormats)).append("\n"); |
| 200 | + sb.append(" simpleValueParseMode: ").append(toIndentedString(simpleValueParseMode)).append("\n"); |
| 201 | + sb.append("}"); |
| 202 | + return sb.toString(); |
| 203 | + } |
| 204 | + |
| 205 | + /** |
| 206 | + * Convert the given object to string with each line indented by 4 spaces |
| 207 | + * (except the first line). |
| 208 | + */ |
| 209 | + private String toIndentedString(java.lang.Object o) { |
| 210 | + if (o == null) { |
| 211 | + return "null"; |
| 212 | + } |
| 213 | + return o.toString().replace("\n", "\n "); |
| 214 | + } |
| 215 | +} |
0 commit comments