001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2020-11-05T09:22:38.113Z 003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 88:1 004package net.gdface.facelog.client.thrift; 005 006import com.microsoft.thrifty.Adapter; 007import com.microsoft.thrifty.Struct; 008import com.microsoft.thrifty.StructBuilder; 009import com.microsoft.thrifty.TType; 010import com.microsoft.thrifty.ThriftField; 011import com.microsoft.thrifty.protocol.FieldMetadata; 012import com.microsoft.thrifty.protocol.Protocol; 013import com.microsoft.thrifty.util.ProtocolUtil; 014import java.io.IOException; 015import javax.annotation.Generated; 016 017@Generated( 018 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 019 comments = "https://github.com/microsoft/thrifty" 020) 021public final class ImageBean implements Struct { 022 public static final Adapter<ImageBean, Builder> ADAPTER = new ImageBeanAdapter(); 023 024 @ThriftField( 025 fieldId = 1, 026 isRequired = true 027 ) 028 public final Boolean _new; 029 030 @ThriftField( 031 fieldId = 2, 032 isRequired = true 033 ) 034 public final Integer modified; 035 036 @ThriftField( 037 fieldId = 3, 038 isRequired = true 039 ) 040 public final Integer initialized; 041 042 @ThriftField( 043 fieldId = 4, 044 isOptional = true 045 ) 046 public final String md5; 047 048 @ThriftField( 049 fieldId = 5, 050 isOptional = true 051 ) 052 public final String format; 053 054 @ThriftField( 055 fieldId = 6, 056 isOptional = true 057 ) 058 public final Integer width; 059 060 @ThriftField( 061 fieldId = 7, 062 isOptional = true 063 ) 064 public final Integer height; 065 066 @ThriftField( 067 fieldId = 8, 068 isOptional = true 069 ) 070 public final Integer depth; 071 072 @ThriftField( 073 fieldId = 9, 074 isOptional = true 075 ) 076 public final Integer faceNum; 077 078 @ThriftField( 079 fieldId = 10, 080 isOptional = true 081 ) 082 public final String thumbMd5; 083 084 @ThriftField( 085 fieldId = 11, 086 isOptional = true 087 ) 088 public final Integer deviceId; 089 090 private ImageBean(Builder builder) { 091 this._new = builder._new; 092 this.modified = builder.modified; 093 this.initialized = builder.initialized; 094 this.md5 = builder.md5; 095 this.format = builder.format; 096 this.width = builder.width; 097 this.height = builder.height; 098 this.depth = builder.depth; 099 this.faceNum = builder.faceNum; 100 this.thumbMd5 = builder.thumbMd5; 101 this.deviceId = builder.deviceId; 102 } 103 104 @Override 105 @SuppressWarnings({"NumberEquality", "StringEquality"}) 106 public boolean equals(Object other) { 107 if (this == other) return true; 108 if (other == null) return false; 109 if (!(other instanceof ImageBean)) return false; 110 ImageBean that = (ImageBean) other; 111 return (this._new == that._new || this._new.equals(that._new)) 112 && (this.modified == that.modified || this.modified.equals(that.modified)) 113 && (this.initialized == that.initialized || this.initialized.equals(that.initialized)) 114 && (this.md5 == that.md5 || (this.md5 != null && this.md5.equals(that.md5))) 115 && (this.format == that.format || (this.format != null && this.format.equals(that.format))) 116 && (this.width == that.width || (this.width != null && this.width.equals(that.width))) 117 && (this.height == that.height || (this.height != null && this.height.equals(that.height))) 118 && (this.depth == that.depth || (this.depth != null && this.depth.equals(that.depth))) 119 && (this.faceNum == that.faceNum || (this.faceNum != null && this.faceNum.equals(that.faceNum))) 120 && (this.thumbMd5 == that.thumbMd5 || (this.thumbMd5 != null && this.thumbMd5.equals(that.thumbMd5))) 121 && (this.deviceId == that.deviceId || (this.deviceId != null && this.deviceId.equals(that.deviceId))); 122 } 123 124 @Override 125 public int hashCode() { 126 int code = 16777619; 127 code ^= this._new.hashCode(); 128 code *= 0x811c9dc5; 129 code ^= this.modified.hashCode(); 130 code *= 0x811c9dc5; 131 code ^= this.initialized.hashCode(); 132 code *= 0x811c9dc5; 133 code ^= (this.md5 == null) ? 0 : this.md5.hashCode(); 134 code *= 0x811c9dc5; 135 code ^= (this.format == null) ? 0 : this.format.hashCode(); 136 code *= 0x811c9dc5; 137 code ^= (this.width == null) ? 0 : this.width.hashCode(); 138 code *= 0x811c9dc5; 139 code ^= (this.height == null) ? 0 : this.height.hashCode(); 140 code *= 0x811c9dc5; 141 code ^= (this.depth == null) ? 0 : this.depth.hashCode(); 142 code *= 0x811c9dc5; 143 code ^= (this.faceNum == null) ? 0 : this.faceNum.hashCode(); 144 code *= 0x811c9dc5; 145 code ^= (this.thumbMd5 == null) ? 0 : this.thumbMd5.hashCode(); 146 code *= 0x811c9dc5; 147 code ^= (this.deviceId == null) ? 0 : this.deviceId.hashCode(); 148 code *= 0x811c9dc5; 149 return code; 150 } 151 152 @Override 153 public String toString() { 154 return "ImageBean{_new=" + this._new + ", modified=" + this.modified + ", initialized=" + this.initialized + ", md5=" + this.md5 + ", format=" + this.format + ", width=" + this.width + ", height=" + this.height + ", depth=" + this.depth + ", faceNum=" + this.faceNum + ", thumbMd5=" + this.thumbMd5 + ", deviceId=" + this.deviceId + "}"; 155 } 156 157 @Override 158 public void write(Protocol protocol) throws IOException { 159 ADAPTER.write(protocol, this); 160 } 161 162 public static final class Builder implements StructBuilder<ImageBean> { 163 private Boolean _new; 164 165 private Integer modified; 166 167 private Integer initialized; 168 169 private String md5; 170 171 private String format; 172 173 private Integer width; 174 175 private Integer height; 176 177 private Integer depth; 178 179 private Integer faceNum; 180 181 private String thumbMd5; 182 183 private Integer deviceId; 184 185 public Builder() { 186 } 187 188 public Builder(ImageBean struct) { 189 this._new = struct._new; 190 this.modified = struct.modified; 191 this.initialized = struct.initialized; 192 this.md5 = struct.md5; 193 this.format = struct.format; 194 this.width = struct.width; 195 this.height = struct.height; 196 this.depth = struct.depth; 197 this.faceNum = struct.faceNum; 198 this.thumbMd5 = struct.thumbMd5; 199 this.deviceId = struct.deviceId; 200 } 201 202 public Builder _new(Boolean _new) { 203 if (_new == null) { 204 throw new NullPointerException("Required field '_new' cannot be null"); 205 } 206 this._new = _new; 207 return this; 208 } 209 210 public Builder modified(Integer modified) { 211 if (modified == null) { 212 throw new NullPointerException("Required field 'modified' cannot be null"); 213 } 214 this.modified = modified; 215 return this; 216 } 217 218 public Builder initialized(Integer initialized) { 219 if (initialized == null) { 220 throw new NullPointerException("Required field 'initialized' cannot be null"); 221 } 222 this.initialized = initialized; 223 return this; 224 } 225 226 public Builder md5(String md5) { 227 this.md5 = md5; 228 return this; 229 } 230 231 public Builder format(String format) { 232 this.format = format; 233 return this; 234 } 235 236 public Builder width(Integer width) { 237 this.width = width; 238 return this; 239 } 240 241 public Builder height(Integer height) { 242 this.height = height; 243 return this; 244 } 245 246 public Builder depth(Integer depth) { 247 this.depth = depth; 248 return this; 249 } 250 251 public Builder faceNum(Integer faceNum) { 252 this.faceNum = faceNum; 253 return this; 254 } 255 256 public Builder thumbMd5(String thumbMd5) { 257 this.thumbMd5 = thumbMd5; 258 return this; 259 } 260 261 public Builder deviceId(Integer deviceId) { 262 this.deviceId = deviceId; 263 return this; 264 } 265 266 @Override 267 public ImageBean build() { 268 if (this._new == null) { 269 throw new IllegalStateException("Required field '_new' is missing"); 270 } 271 if (this.modified == null) { 272 throw new IllegalStateException("Required field 'modified' is missing"); 273 } 274 if (this.initialized == null) { 275 throw new IllegalStateException("Required field 'initialized' is missing"); 276 } 277 return new ImageBean(this); 278 } 279 280 @Override 281 public void reset() { 282 this._new = null; 283 this.modified = null; 284 this.initialized = null; 285 this.md5 = null; 286 this.format = null; 287 this.width = null; 288 this.height = null; 289 this.depth = null; 290 this.faceNum = null; 291 this.thumbMd5 = null; 292 this.deviceId = null; 293 } 294 } 295 296 private static final class ImageBeanAdapter implements Adapter<ImageBean, Builder> { 297 @Override 298 public void write(Protocol protocol, ImageBean struct) throws IOException { 299 protocol.writeStructBegin("ImageBean"); 300 protocol.writeFieldBegin("_new", 1, TType.BOOL); 301 protocol.writeBool(struct._new); 302 protocol.writeFieldEnd(); 303 protocol.writeFieldBegin("modified", 2, TType.I32); 304 protocol.writeI32(struct.modified); 305 protocol.writeFieldEnd(); 306 protocol.writeFieldBegin("initialized", 3, TType.I32); 307 protocol.writeI32(struct.initialized); 308 protocol.writeFieldEnd(); 309 if (struct.md5 != null) { 310 protocol.writeFieldBegin("md5", 4, TType.STRING); 311 protocol.writeString(struct.md5); 312 protocol.writeFieldEnd(); 313 } 314 if (struct.format != null) { 315 protocol.writeFieldBegin("format", 5, TType.STRING); 316 protocol.writeString(struct.format); 317 protocol.writeFieldEnd(); 318 } 319 if (struct.width != null) { 320 protocol.writeFieldBegin("width", 6, TType.I32); 321 protocol.writeI32(struct.width); 322 protocol.writeFieldEnd(); 323 } 324 if (struct.height != null) { 325 protocol.writeFieldBegin("height", 7, TType.I32); 326 protocol.writeI32(struct.height); 327 protocol.writeFieldEnd(); 328 } 329 if (struct.depth != null) { 330 protocol.writeFieldBegin("depth", 8, TType.I32); 331 protocol.writeI32(struct.depth); 332 protocol.writeFieldEnd(); 333 } 334 if (struct.faceNum != null) { 335 protocol.writeFieldBegin("faceNum", 9, TType.I32); 336 protocol.writeI32(struct.faceNum); 337 protocol.writeFieldEnd(); 338 } 339 if (struct.thumbMd5 != null) { 340 protocol.writeFieldBegin("thumbMd5", 10, TType.STRING); 341 protocol.writeString(struct.thumbMd5); 342 protocol.writeFieldEnd(); 343 } 344 if (struct.deviceId != null) { 345 protocol.writeFieldBegin("deviceId", 11, TType.I32); 346 protocol.writeI32(struct.deviceId); 347 protocol.writeFieldEnd(); 348 } 349 protocol.writeFieldStop(); 350 protocol.writeStructEnd(); 351 } 352 353 @Override 354 public ImageBean read(Protocol protocol, Builder builder) throws IOException { 355 protocol.readStructBegin(); 356 while (true) { 357 FieldMetadata field = protocol.readFieldBegin(); 358 if (field.typeId == TType.STOP) { 359 break; 360 } 361 switch (field.fieldId) { 362 case 1: { 363 if (field.typeId == TType.BOOL) { 364 boolean value = protocol.readBool(); 365 builder._new(value); 366 } else { 367 ProtocolUtil.skip(protocol, field.typeId); 368 } 369 } 370 break; 371 case 2: { 372 if (field.typeId == TType.I32) { 373 int value = protocol.readI32(); 374 builder.modified(value); 375 } else { 376 ProtocolUtil.skip(protocol, field.typeId); 377 } 378 } 379 break; 380 case 3: { 381 if (field.typeId == TType.I32) { 382 int value = protocol.readI32(); 383 builder.initialized(value); 384 } else { 385 ProtocolUtil.skip(protocol, field.typeId); 386 } 387 } 388 break; 389 case 4: { 390 if (field.typeId == TType.STRING) { 391 String value = protocol.readString(); 392 builder.md5(value); 393 } else { 394 ProtocolUtil.skip(protocol, field.typeId); 395 } 396 } 397 break; 398 case 5: { 399 if (field.typeId == TType.STRING) { 400 String value = protocol.readString(); 401 builder.format(value); 402 } else { 403 ProtocolUtil.skip(protocol, field.typeId); 404 } 405 } 406 break; 407 case 6: { 408 if (field.typeId == TType.I32) { 409 int value = protocol.readI32(); 410 builder.width(value); 411 } else { 412 ProtocolUtil.skip(protocol, field.typeId); 413 } 414 } 415 break; 416 case 7: { 417 if (field.typeId == TType.I32) { 418 int value = protocol.readI32(); 419 builder.height(value); 420 } else { 421 ProtocolUtil.skip(protocol, field.typeId); 422 } 423 } 424 break; 425 case 8: { 426 if (field.typeId == TType.I32) { 427 int value = protocol.readI32(); 428 builder.depth(value); 429 } else { 430 ProtocolUtil.skip(protocol, field.typeId); 431 } 432 } 433 break; 434 case 9: { 435 if (field.typeId == TType.I32) { 436 int value = protocol.readI32(); 437 builder.faceNum(value); 438 } else { 439 ProtocolUtil.skip(protocol, field.typeId); 440 } 441 } 442 break; 443 case 10: { 444 if (field.typeId == TType.STRING) { 445 String value = protocol.readString(); 446 builder.thumbMd5(value); 447 } else { 448 ProtocolUtil.skip(protocol, field.typeId); 449 } 450 } 451 break; 452 case 11: { 453 if (field.typeId == TType.I32) { 454 int value = protocol.readI32(); 455 builder.deviceId(value); 456 } else { 457 ProtocolUtil.skip(protocol, field.typeId); 458 } 459 } 460 break; 461 default: { 462 ProtocolUtil.skip(protocol, field.typeId); 463 } 464 break; 465 } 466 protocol.readFieldEnd(); 467 } 468 protocol.readStructEnd(); 469 return builder.build(); 470 } 471 472 @Override 473 public ImageBean read(Protocol protocol) throws IOException { 474 return read(protocol, new Builder()); 475 } 476 } 477}