001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2021-05-17T06:20:27.420Z
003// Source: J:\facedb\facedb-service\FaceDb.thrift at 61:1
004package net.gdface.facedb.thrift.client;
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 location;
083
084  @ThriftField(
085      fieldId = 11,
086      isOptional = true
087  )
088  public final Long updateTime;
089
090  @ThriftField(
091      fieldId = 12,
092      isOptional = true
093  )
094  public final Long createTime;
095
096  private ImageBean(Builder builder) {
097    this._new = builder._new;
098    this.modified = builder.modified;
099    this.initialized = builder.initialized;
100    this.md5 = builder.md5;
101    this.format = builder.format;
102    this.width = builder.width;
103    this.height = builder.height;
104    this.depth = builder.depth;
105    this.faceNum = builder.faceNum;
106    this.location = builder.location;
107    this.updateTime = builder.updateTime;
108    this.createTime = builder.createTime;
109  }
110
111  @Override
112  @SuppressWarnings({"NumberEquality", "StringEquality"})
113  public boolean equals(Object other) {
114    if (this == other) return true;
115    if (other == null) return false;
116    if (!(other instanceof ImageBean)) return false;
117    ImageBean that = (ImageBean) other;
118    return (this._new == that._new || this._new.equals(that._new))
119        && (this.modified == that.modified || this.modified.equals(that.modified))
120        && (this.initialized == that.initialized || this.initialized.equals(that.initialized))
121        && (this.md5 == that.md5 || (this.md5 != null && this.md5.equals(that.md5)))
122        && (this.format == that.format || (this.format != null && this.format.equals(that.format)))
123        && (this.width == that.width || (this.width != null && this.width.equals(that.width)))
124        && (this.height == that.height || (this.height != null && this.height.equals(that.height)))
125        && (this.depth == that.depth || (this.depth != null && this.depth.equals(that.depth)))
126        && (this.faceNum == that.faceNum || (this.faceNum != null && this.faceNum.equals(that.faceNum)))
127        && (this.location == that.location || (this.location != null && this.location.equals(that.location)))
128        && (this.updateTime == that.updateTime || (this.updateTime != null && this.updateTime.equals(that.updateTime)))
129        && (this.createTime == that.createTime || (this.createTime != null && this.createTime.equals(that.createTime)));
130  }
131
132  @Override
133  public int hashCode() {
134    int code = 16777619;
135    code ^= this._new.hashCode();
136    code *= 0x811c9dc5;
137    code ^= this.modified.hashCode();
138    code *= 0x811c9dc5;
139    code ^= this.initialized.hashCode();
140    code *= 0x811c9dc5;
141    code ^= (this.md5 == null) ? 0 : this.md5.hashCode();
142    code *= 0x811c9dc5;
143    code ^= (this.format == null) ? 0 : this.format.hashCode();
144    code *= 0x811c9dc5;
145    code ^= (this.width == null) ? 0 : this.width.hashCode();
146    code *= 0x811c9dc5;
147    code ^= (this.height == null) ? 0 : this.height.hashCode();
148    code *= 0x811c9dc5;
149    code ^= (this.depth == null) ? 0 : this.depth.hashCode();
150    code *= 0x811c9dc5;
151    code ^= (this.faceNum == null) ? 0 : this.faceNum.hashCode();
152    code *= 0x811c9dc5;
153    code ^= (this.location == null) ? 0 : this.location.hashCode();
154    code *= 0x811c9dc5;
155    code ^= (this.updateTime == null) ? 0 : this.updateTime.hashCode();
156    code *= 0x811c9dc5;
157    code ^= (this.createTime == null) ? 0 : this.createTime.hashCode();
158    code *= 0x811c9dc5;
159    return code;
160  }
161
162  @Override
163  public String toString() {
164    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 + ", location=" + this.location + ", updateTime=" + this.updateTime + ", createTime=" + this.createTime + "}";
165  }
166
167  @Override
168  public void write(Protocol protocol) throws IOException {
169    ADAPTER.write(protocol, this);
170  }
171
172  public static final class Builder implements StructBuilder<ImageBean> {
173    private Boolean _new;
174
175    private Integer modified;
176
177    private Integer initialized;
178
179    private String md5;
180
181    private String format;
182
183    private Integer width;
184
185    private Integer height;
186
187    private Integer depth;
188
189    private Integer faceNum;
190
191    private String location;
192
193    private Long updateTime;
194
195    private Long createTime;
196
197    public Builder() {
198    }
199
200    public Builder(ImageBean struct) {
201      this._new = struct._new;
202      this.modified = struct.modified;
203      this.initialized = struct.initialized;
204      this.md5 = struct.md5;
205      this.format = struct.format;
206      this.width = struct.width;
207      this.height = struct.height;
208      this.depth = struct.depth;
209      this.faceNum = struct.faceNum;
210      this.location = struct.location;
211      this.updateTime = struct.updateTime;
212      this.createTime = struct.createTime;
213    }
214
215    public Builder _new(Boolean _new) {
216      if (_new == null) {
217        throw new NullPointerException("Required field '_new' cannot be null");
218      }
219      this._new = _new;
220      return this;
221    }
222
223    public Builder modified(Integer modified) {
224      if (modified == null) {
225        throw new NullPointerException("Required field 'modified' cannot be null");
226      }
227      this.modified = modified;
228      return this;
229    }
230
231    public Builder initialized(Integer initialized) {
232      if (initialized == null) {
233        throw new NullPointerException("Required field 'initialized' cannot be null");
234      }
235      this.initialized = initialized;
236      return this;
237    }
238
239    public Builder md5(String md5) {
240      this.md5 = md5;
241      return this;
242    }
243
244    public Builder format(String format) {
245      this.format = format;
246      return this;
247    }
248
249    public Builder width(Integer width) {
250      this.width = width;
251      return this;
252    }
253
254    public Builder height(Integer height) {
255      this.height = height;
256      return this;
257    }
258
259    public Builder depth(Integer depth) {
260      this.depth = depth;
261      return this;
262    }
263
264    public Builder faceNum(Integer faceNum) {
265      this.faceNum = faceNum;
266      return this;
267    }
268
269    public Builder location(String location) {
270      this.location = location;
271      return this;
272    }
273
274    public Builder updateTime(Long updateTime) {
275      this.updateTime = updateTime;
276      return this;
277    }
278
279    public Builder createTime(Long createTime) {
280      this.createTime = createTime;
281      return this;
282    }
283
284    @Override
285    public ImageBean build() {
286      if (this._new == null) {
287        throw new IllegalStateException("Required field '_new' is missing");
288      }
289      if (this.modified == null) {
290        throw new IllegalStateException("Required field 'modified' is missing");
291      }
292      if (this.initialized == null) {
293        throw new IllegalStateException("Required field 'initialized' is missing");
294      }
295      return new ImageBean(this);
296    }
297
298    @Override
299    public void reset() {
300      this._new = null;
301      this.modified = null;
302      this.initialized = null;
303      this.md5 = null;
304      this.format = null;
305      this.width = null;
306      this.height = null;
307      this.depth = null;
308      this.faceNum = null;
309      this.location = null;
310      this.updateTime = null;
311      this.createTime = null;
312    }
313  }
314
315  private static final class ImageBeanAdapter implements Adapter<ImageBean, Builder> {
316    @Override
317    public void write(Protocol protocol, ImageBean struct) throws IOException {
318      protocol.writeStructBegin("ImageBean");
319      protocol.writeFieldBegin("_new", 1, TType.BOOL);
320      protocol.writeBool(struct._new);
321      protocol.writeFieldEnd();
322      protocol.writeFieldBegin("modified", 2, TType.I32);
323      protocol.writeI32(struct.modified);
324      protocol.writeFieldEnd();
325      protocol.writeFieldBegin("initialized", 3, TType.I32);
326      protocol.writeI32(struct.initialized);
327      protocol.writeFieldEnd();
328      if (struct.md5 != null) {
329        protocol.writeFieldBegin("md5", 4, TType.STRING);
330        protocol.writeString(struct.md5);
331        protocol.writeFieldEnd();
332      }
333      if (struct.format != null) {
334        protocol.writeFieldBegin("format", 5, TType.STRING);
335        protocol.writeString(struct.format);
336        protocol.writeFieldEnd();
337      }
338      if (struct.width != null) {
339        protocol.writeFieldBegin("width", 6, TType.I32);
340        protocol.writeI32(struct.width);
341        protocol.writeFieldEnd();
342      }
343      if (struct.height != null) {
344        protocol.writeFieldBegin("height", 7, TType.I32);
345        protocol.writeI32(struct.height);
346        protocol.writeFieldEnd();
347      }
348      if (struct.depth != null) {
349        protocol.writeFieldBegin("depth", 8, TType.I32);
350        protocol.writeI32(struct.depth);
351        protocol.writeFieldEnd();
352      }
353      if (struct.faceNum != null) {
354        protocol.writeFieldBegin("faceNum", 9, TType.I32);
355        protocol.writeI32(struct.faceNum);
356        protocol.writeFieldEnd();
357      }
358      if (struct.location != null) {
359        protocol.writeFieldBegin("location", 10, TType.STRING);
360        protocol.writeString(struct.location);
361        protocol.writeFieldEnd();
362      }
363      if (struct.updateTime != null) {
364        protocol.writeFieldBegin("updateTime", 11, TType.I64);
365        protocol.writeI64(struct.updateTime);
366        protocol.writeFieldEnd();
367      }
368      if (struct.createTime != null) {
369        protocol.writeFieldBegin("createTime", 12, TType.I64);
370        protocol.writeI64(struct.createTime);
371        protocol.writeFieldEnd();
372      }
373      protocol.writeFieldStop();
374      protocol.writeStructEnd();
375    }
376
377    @Override
378    public ImageBean read(Protocol protocol, Builder builder) throws IOException {
379      protocol.readStructBegin();
380      while (true) {
381        FieldMetadata field = protocol.readFieldBegin();
382        if (field.typeId == TType.STOP) {
383          break;
384        }
385        switch (field.fieldId) {
386          case 1: {
387            if (field.typeId == TType.BOOL) {
388              boolean value = protocol.readBool();
389              builder._new(value);
390            } else {
391              ProtocolUtil.skip(protocol, field.typeId);
392            }
393          }
394          break;
395          case 2: {
396            if (field.typeId == TType.I32) {
397              int value = protocol.readI32();
398              builder.modified(value);
399            } else {
400              ProtocolUtil.skip(protocol, field.typeId);
401            }
402          }
403          break;
404          case 3: {
405            if (field.typeId == TType.I32) {
406              int value = protocol.readI32();
407              builder.initialized(value);
408            } else {
409              ProtocolUtil.skip(protocol, field.typeId);
410            }
411          }
412          break;
413          case 4: {
414            if (field.typeId == TType.STRING) {
415              String value = protocol.readString();
416              builder.md5(value);
417            } else {
418              ProtocolUtil.skip(protocol, field.typeId);
419            }
420          }
421          break;
422          case 5: {
423            if (field.typeId == TType.STRING) {
424              String value = protocol.readString();
425              builder.format(value);
426            } else {
427              ProtocolUtil.skip(protocol, field.typeId);
428            }
429          }
430          break;
431          case 6: {
432            if (field.typeId == TType.I32) {
433              int value = protocol.readI32();
434              builder.width(value);
435            } else {
436              ProtocolUtil.skip(protocol, field.typeId);
437            }
438          }
439          break;
440          case 7: {
441            if (field.typeId == TType.I32) {
442              int value = protocol.readI32();
443              builder.height(value);
444            } else {
445              ProtocolUtil.skip(protocol, field.typeId);
446            }
447          }
448          break;
449          case 8: {
450            if (field.typeId == TType.I32) {
451              int value = protocol.readI32();
452              builder.depth(value);
453            } else {
454              ProtocolUtil.skip(protocol, field.typeId);
455            }
456          }
457          break;
458          case 9: {
459            if (field.typeId == TType.I32) {
460              int value = protocol.readI32();
461              builder.faceNum(value);
462            } else {
463              ProtocolUtil.skip(protocol, field.typeId);
464            }
465          }
466          break;
467          case 10: {
468            if (field.typeId == TType.STRING) {
469              String value = protocol.readString();
470              builder.location(value);
471            } else {
472              ProtocolUtil.skip(protocol, field.typeId);
473            }
474          }
475          break;
476          case 11: {
477            if (field.typeId == TType.I64) {
478              long value = protocol.readI64();
479              builder.updateTime(value);
480            } else {
481              ProtocolUtil.skip(protocol, field.typeId);
482            }
483          }
484          break;
485          case 12: {
486            if (field.typeId == TType.I64) {
487              long value = protocol.readI64();
488              builder.createTime(value);
489            } else {
490              ProtocolUtil.skip(protocol, field.typeId);
491            }
492          }
493          break;
494          default: {
495            ProtocolUtil.skip(protocol, field.typeId);
496          }
497          break;
498        }
499        protocol.readFieldEnd();
500      }
501      protocol.readStructEnd();
502      return builder.build();
503    }
504
505    @Override
506    public ImageBean read(Protocol protocol) throws IOException {
507      return read(protocol, new Builder());
508    }
509  }
510}