001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2020-11-05T09:22:38.111Z
003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 77: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;
016import okio.ByteString;
017
018@Generated(
019    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
020    comments = "https://github.com/microsoft/thrifty"
021)
022public final class FeatureBean implements Struct {
023  public static final Adapter<FeatureBean, Builder> ADAPTER = new FeatureBeanAdapter();
024
025  @ThriftField(
026      fieldId = 1,
027      isRequired = true
028  )
029  public final Boolean _new;
030
031  @ThriftField(
032      fieldId = 2,
033      isRequired = true
034  )
035  public final Integer modified;
036
037  @ThriftField(
038      fieldId = 3,
039      isRequired = true
040  )
041  public final Integer initialized;
042
043  @ThriftField(
044      fieldId = 4,
045      isOptional = true
046  )
047  public final String md5;
048
049  @ThriftField(
050      fieldId = 5,
051      isOptional = true
052  )
053  public final String version;
054
055  @ThriftField(
056      fieldId = 6,
057      isOptional = true
058  )
059  public final Integer personId;
060
061  @ThriftField(
062      fieldId = 7,
063      isOptional = true
064  )
065  public final ByteString feature;
066
067  @ThriftField(
068      fieldId = 8,
069      isOptional = true
070  )
071  public final Long updateTime;
072
073  private FeatureBean(Builder builder) {
074    this._new = builder._new;
075    this.modified = builder.modified;
076    this.initialized = builder.initialized;
077    this.md5 = builder.md5;
078    this.version = builder.version;
079    this.personId = builder.personId;
080    this.feature = builder.feature;
081    this.updateTime = builder.updateTime;
082  }
083
084  @Override
085  @SuppressWarnings({"NumberEquality", "StringEquality"})
086  public boolean equals(Object other) {
087    if (this == other) return true;
088    if (other == null) return false;
089    if (!(other instanceof FeatureBean)) return false;
090    FeatureBean that = (FeatureBean) other;
091    return (this._new == that._new || this._new.equals(that._new))
092        && (this.modified == that.modified || this.modified.equals(that.modified))
093        && (this.initialized == that.initialized || this.initialized.equals(that.initialized))
094        && (this.md5 == that.md5 || (this.md5 != null && this.md5.equals(that.md5)))
095        && (this.version == that.version || (this.version != null && this.version.equals(that.version)))
096        && (this.personId == that.personId || (this.personId != null && this.personId.equals(that.personId)))
097        && (this.feature == that.feature || (this.feature != null && this.feature.equals(that.feature)))
098        && (this.updateTime == that.updateTime || (this.updateTime != null && this.updateTime.equals(that.updateTime)));
099  }
100
101  @Override
102  public int hashCode() {
103    int code = 16777619;
104    code ^= this._new.hashCode();
105    code *= 0x811c9dc5;
106    code ^= this.modified.hashCode();
107    code *= 0x811c9dc5;
108    code ^= this.initialized.hashCode();
109    code *= 0x811c9dc5;
110    code ^= (this.md5 == null) ? 0 : this.md5.hashCode();
111    code *= 0x811c9dc5;
112    code ^= (this.version == null) ? 0 : this.version.hashCode();
113    code *= 0x811c9dc5;
114    code ^= (this.personId == null) ? 0 : this.personId.hashCode();
115    code *= 0x811c9dc5;
116    code ^= (this.feature == null) ? 0 : this.feature.hashCode();
117    code *= 0x811c9dc5;
118    code ^= (this.updateTime == null) ? 0 : this.updateTime.hashCode();
119    code *= 0x811c9dc5;
120    return code;
121  }
122
123  @Override
124  public String toString() {
125    return "FeatureBean{_new=" + this._new + ", modified=" + this.modified + ", initialized=" + this.initialized + ", md5=" + this.md5 + ", version=" + this.version + ", personId=" + this.personId + ", feature=" + this.feature + ", updateTime=" + this.updateTime + "}";
126  }
127
128  @Override
129  public void write(Protocol protocol) throws IOException {
130    ADAPTER.write(protocol, this);
131  }
132
133  public static final class Builder implements StructBuilder<FeatureBean> {
134    private Boolean _new;
135
136    private Integer modified;
137
138    private Integer initialized;
139
140    private String md5;
141
142    private String version;
143
144    private Integer personId;
145
146    private ByteString feature;
147
148    private Long updateTime;
149
150    public Builder() {
151    }
152
153    public Builder(FeatureBean struct) {
154      this._new = struct._new;
155      this.modified = struct.modified;
156      this.initialized = struct.initialized;
157      this.md5 = struct.md5;
158      this.version = struct.version;
159      this.personId = struct.personId;
160      this.feature = struct.feature;
161      this.updateTime = struct.updateTime;
162    }
163
164    public Builder _new(Boolean _new) {
165      if (_new == null) {
166        throw new NullPointerException("Required field '_new' cannot be null");
167      }
168      this._new = _new;
169      return this;
170    }
171
172    public Builder modified(Integer modified) {
173      if (modified == null) {
174        throw new NullPointerException("Required field 'modified' cannot be null");
175      }
176      this.modified = modified;
177      return this;
178    }
179
180    public Builder initialized(Integer initialized) {
181      if (initialized == null) {
182        throw new NullPointerException("Required field 'initialized' cannot be null");
183      }
184      this.initialized = initialized;
185      return this;
186    }
187
188    public Builder md5(String md5) {
189      this.md5 = md5;
190      return this;
191    }
192
193    public Builder version(String version) {
194      this.version = version;
195      return this;
196    }
197
198    public Builder personId(Integer personId) {
199      this.personId = personId;
200      return this;
201    }
202
203    public Builder feature(ByteString feature) {
204      this.feature = feature;
205      return this;
206    }
207
208    public Builder updateTime(Long updateTime) {
209      this.updateTime = updateTime;
210      return this;
211    }
212
213    @Override
214    public FeatureBean build() {
215      if (this._new == null) {
216        throw new IllegalStateException("Required field '_new' is missing");
217      }
218      if (this.modified == null) {
219        throw new IllegalStateException("Required field 'modified' is missing");
220      }
221      if (this.initialized == null) {
222        throw new IllegalStateException("Required field 'initialized' is missing");
223      }
224      return new FeatureBean(this);
225    }
226
227    @Override
228    public void reset() {
229      this._new = null;
230      this.modified = null;
231      this.initialized = null;
232      this.md5 = null;
233      this.version = null;
234      this.personId = null;
235      this.feature = null;
236      this.updateTime = null;
237    }
238  }
239
240  private static final class FeatureBeanAdapter implements Adapter<FeatureBean, Builder> {
241    @Override
242    public void write(Protocol protocol, FeatureBean struct) throws IOException {
243      protocol.writeStructBegin("FeatureBean");
244      protocol.writeFieldBegin("_new", 1, TType.BOOL);
245      protocol.writeBool(struct._new);
246      protocol.writeFieldEnd();
247      protocol.writeFieldBegin("modified", 2, TType.I32);
248      protocol.writeI32(struct.modified);
249      protocol.writeFieldEnd();
250      protocol.writeFieldBegin("initialized", 3, TType.I32);
251      protocol.writeI32(struct.initialized);
252      protocol.writeFieldEnd();
253      if (struct.md5 != null) {
254        protocol.writeFieldBegin("md5", 4, TType.STRING);
255        protocol.writeString(struct.md5);
256        protocol.writeFieldEnd();
257      }
258      if (struct.version != null) {
259        protocol.writeFieldBegin("version", 5, TType.STRING);
260        protocol.writeString(struct.version);
261        protocol.writeFieldEnd();
262      }
263      if (struct.personId != null) {
264        protocol.writeFieldBegin("personId", 6, TType.I32);
265        protocol.writeI32(struct.personId);
266        protocol.writeFieldEnd();
267      }
268      if (struct.feature != null) {
269        protocol.writeFieldBegin("feature", 7, TType.STRING);
270        protocol.writeBinary(struct.feature);
271        protocol.writeFieldEnd();
272      }
273      if (struct.updateTime != null) {
274        protocol.writeFieldBegin("updateTime", 8, TType.I64);
275        protocol.writeI64(struct.updateTime);
276        protocol.writeFieldEnd();
277      }
278      protocol.writeFieldStop();
279      protocol.writeStructEnd();
280    }
281
282    @Override
283    public FeatureBean read(Protocol protocol, Builder builder) throws IOException {
284      protocol.readStructBegin();
285      while (true) {
286        FieldMetadata field = protocol.readFieldBegin();
287        if (field.typeId == TType.STOP) {
288          break;
289        }
290        switch (field.fieldId) {
291          case 1: {
292            if (field.typeId == TType.BOOL) {
293              boolean value = protocol.readBool();
294              builder._new(value);
295            } else {
296              ProtocolUtil.skip(protocol, field.typeId);
297            }
298          }
299          break;
300          case 2: {
301            if (field.typeId == TType.I32) {
302              int value = protocol.readI32();
303              builder.modified(value);
304            } else {
305              ProtocolUtil.skip(protocol, field.typeId);
306            }
307          }
308          break;
309          case 3: {
310            if (field.typeId == TType.I32) {
311              int value = protocol.readI32();
312              builder.initialized(value);
313            } else {
314              ProtocolUtil.skip(protocol, field.typeId);
315            }
316          }
317          break;
318          case 4: {
319            if (field.typeId == TType.STRING) {
320              String value = protocol.readString();
321              builder.md5(value);
322            } else {
323              ProtocolUtil.skip(protocol, field.typeId);
324            }
325          }
326          break;
327          case 5: {
328            if (field.typeId == TType.STRING) {
329              String value = protocol.readString();
330              builder.version(value);
331            } else {
332              ProtocolUtil.skip(protocol, field.typeId);
333            }
334          }
335          break;
336          case 6: {
337            if (field.typeId == TType.I32) {
338              int value = protocol.readI32();
339              builder.personId(value);
340            } else {
341              ProtocolUtil.skip(protocol, field.typeId);
342            }
343          }
344          break;
345          case 7: {
346            if (field.typeId == TType.STRING) {
347              ByteString value = protocol.readBinary();
348              builder.feature(value);
349            } else {
350              ProtocolUtil.skip(protocol, field.typeId);
351            }
352          }
353          break;
354          case 8: {
355            if (field.typeId == TType.I64) {
356              long value = protocol.readI64();
357              builder.updateTime(value);
358            } else {
359              ProtocolUtil.skip(protocol, field.typeId);
360            }
361          }
362          break;
363          default: {
364            ProtocolUtil.skip(protocol, field.typeId);
365          }
366          break;
367        }
368        protocol.readFieldEnd();
369      }
370      protocol.readStructEnd();
371      return builder.build();
372    }
373
374    @Override
375    public FeatureBean read(Protocol protocol) throws IOException {
376      return read(protocol, new Builder());
377    }
378  }
379}