|
| 1 | +/** |
| 2 | + * -------------------------------------------------------------------------------------------------------------------- |
| 3 | + * <copyright company="Aspose Pty Ltd" file="CadConvertOptions.java"> |
| 4 | + * Copyright (c) Aspose Pty Ltd |
| 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.groupdocs.cloud.conversion.model; |
| 29 | + |
| 30 | +import java.util.Objects; |
| 31 | +import com.google.gson.TypeAdapter; |
| 32 | +import com.google.gson.annotations.JsonAdapter; |
| 33 | +import com.google.gson.annotations.SerializedName; |
| 34 | +import com.google.gson.stream.JsonReader; |
| 35 | +import com.google.gson.stream.JsonWriter; |
| 36 | +import com.groupdocs.cloud.conversion.model.ConvertOptions; |
| 37 | +import com.groupdocs.cloud.conversion.model.WatermarkOptions; |
| 38 | +import io.swagger.annotations.ApiModel; |
| 39 | +import io.swagger.annotations.ApiModelProperty; |
| 40 | +import java.io.IOException; |
| 41 | +import java.util.List; |
| 42 | + |
| 43 | +/** |
| 44 | + * Options for to Cad conversion |
| 45 | + */ |
| 46 | +@ApiModel(description = "Options for to Cad conversion") |
| 47 | +public class CadConvertOptions extends ConvertOptions { |
| 48 | + @SerializedName("width") |
| 49 | + private Integer width = null; |
| 50 | + |
| 51 | + @SerializedName("height") |
| 52 | + private Integer height = null; |
| 53 | + |
| 54 | + /** |
| 55 | + * Page size |
| 56 | + */ |
| 57 | + @JsonAdapter(PageSizeEnum.Adapter.class) |
| 58 | + public enum PageSizeEnum { |
| 59 | + DEFAULT("Default"), |
| 60 | + |
| 61 | + A3("A3"), |
| 62 | + |
| 63 | + STATEMENT("Statement"), |
| 64 | + |
| 65 | + QUARTO("Quarto"), |
| 66 | + |
| 67 | + PAPER11X17("Paper11x17"), |
| 68 | + |
| 69 | + PAPER10X14("Paper10x14"), |
| 70 | + |
| 71 | + LETTER("Letter"), |
| 72 | + |
| 73 | + LEGAL("Legal"), |
| 74 | + |
| 75 | + LEDGER("Ledger"), |
| 76 | + |
| 77 | + FOLIO("Folio"), |
| 78 | + |
| 79 | + EXECUTIVE("Executive"), |
| 80 | + |
| 81 | + ENVELOPEDL("EnvelopeDL"), |
| 82 | + |
| 83 | + CUSTOM("Custom"), |
| 84 | + |
| 85 | + B5("B5"), |
| 86 | + |
| 87 | + B4("B4"), |
| 88 | + |
| 89 | + A5("A5"), |
| 90 | + |
| 91 | + A4("A4"), |
| 92 | + |
| 93 | + TABLOID("Tabloid"); |
| 94 | + |
| 95 | + private String value; |
| 96 | + |
| 97 | + PageSizeEnum(String value) { |
| 98 | + this.value = value; |
| 99 | + } |
| 100 | + |
| 101 | + public String getValue() { |
| 102 | + return value; |
| 103 | + } |
| 104 | + |
| 105 | + @Override |
| 106 | + public String toString() { |
| 107 | + return String.valueOf(value); |
| 108 | + } |
| 109 | + |
| 110 | + public static PageSizeEnum fromValue(String text) { |
| 111 | + for (PageSizeEnum b : PageSizeEnum.values()) { |
| 112 | + if (String.valueOf(b.value).equals(text)) { |
| 113 | + return b; |
| 114 | + } |
| 115 | + } |
| 116 | + return null; |
| 117 | + } |
| 118 | + |
| 119 | + public static class Adapter extends TypeAdapter<PageSizeEnum> { |
| 120 | + @Override |
| 121 | + public void write(final JsonWriter jsonWriter, final PageSizeEnum enumeration) throws IOException { |
| 122 | + jsonWriter.value(enumeration.getValue()); |
| 123 | + } |
| 124 | + |
| 125 | + @Override |
| 126 | + public PageSizeEnum read(final JsonReader jsonReader) throws IOException { |
| 127 | + String value = jsonReader.nextString(); |
| 128 | + return PageSizeEnum.fromValue(String.valueOf(value)); |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + @SerializedName("pageSize") |
| 134 | + private PageSizeEnum pageSize = null; |
| 135 | + |
| 136 | + public CadConvertOptions width(Integer width) { |
| 137 | + this.width = width; |
| 138 | + return this; |
| 139 | + } |
| 140 | + |
| 141 | + /** |
| 142 | + * Desired page width after conversion |
| 143 | + * @return width |
| 144 | + **/ |
| 145 | + @ApiModelProperty(required = true, value = "Desired page width after conversion") |
| 146 | + public Integer getWidth() { |
| 147 | + return width; |
| 148 | + } |
| 149 | + |
| 150 | + public void setWidth(Integer width) { |
| 151 | + this.width = width; |
| 152 | + } |
| 153 | + |
| 154 | + public CadConvertOptions height(Integer height) { |
| 155 | + this.height = height; |
| 156 | + return this; |
| 157 | + } |
| 158 | + |
| 159 | + /** |
| 160 | + * Desired page height after conversion |
| 161 | + * @return height |
| 162 | + **/ |
| 163 | + @ApiModelProperty(required = true, value = "Desired page height after conversion") |
| 164 | + public Integer getHeight() { |
| 165 | + return height; |
| 166 | + } |
| 167 | + |
| 168 | + public void setHeight(Integer height) { |
| 169 | + this.height = height; |
| 170 | + } |
| 171 | + |
| 172 | + public CadConvertOptions pageSize(PageSizeEnum pageSize) { |
| 173 | + this.pageSize = pageSize; |
| 174 | + return this; |
| 175 | + } |
| 176 | + |
| 177 | + /** |
| 178 | + * Page size |
| 179 | + * @return pageSize |
| 180 | + **/ |
| 181 | + @ApiModelProperty(required = true, value = "Page size") |
| 182 | + public PageSizeEnum getPageSize() { |
| 183 | + return pageSize; |
| 184 | + } |
| 185 | + |
| 186 | + public void setPageSize(PageSizeEnum pageSize) { |
| 187 | + this.pageSize = pageSize; |
| 188 | + } |
| 189 | + |
| 190 | + |
| 191 | + @Override |
| 192 | + public boolean equals(java.lang.Object o) { |
| 193 | + if (this == o) { |
| 194 | + return true; |
| 195 | + } |
| 196 | + if (o == null || getClass() != o.getClass()) { |
| 197 | + return false; |
| 198 | + } |
| 199 | + CadConvertOptions cadConvertOptions = (CadConvertOptions) o; |
| 200 | + return Objects.equals(this.width, cadConvertOptions.width) && |
| 201 | + Objects.equals(this.height, cadConvertOptions.height) && |
| 202 | + Objects.equals(this.pageSize, cadConvertOptions.pageSize) && |
| 203 | + super.equals(o); |
| 204 | + } |
| 205 | + |
| 206 | + @Override |
| 207 | + public int hashCode() { |
| 208 | + return Objects.hash(width, height, pageSize, super.hashCode()); |
| 209 | + } |
| 210 | + |
| 211 | + |
| 212 | + @Override |
| 213 | + public String toString() { |
| 214 | + StringBuilder sb = new StringBuilder(); |
| 215 | + sb.append("class CadConvertOptions {\n"); |
| 216 | + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); |
| 217 | + sb.append(" width: ").append(toIndentedString(width)).append("\n"); |
| 218 | + sb.append(" height: ").append(toIndentedString(height)).append("\n"); |
| 219 | + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); |
| 220 | + sb.append("}"); |
| 221 | + return sb.toString(); |
| 222 | + } |
| 223 | + |
| 224 | + /** |
| 225 | + * Convert the given object to string with each line indented by 4 spaces |
| 226 | + * (except the first line). |
| 227 | + */ |
| 228 | + private String toIndentedString(java.lang.Object o) { |
| 229 | + if (o == null) { |
| 230 | + return "null"; |
| 231 | + } |
| 232 | + return o.toString().replace("\n", "\n "); |
| 233 | + } |
| 234 | + |
| 235 | +} |
| 236 | + |
0 commit comments