001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2020-11-05T09:22:38.127Z
003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 273: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.ListMetadata;
013import com.microsoft.thrifty.protocol.Protocol;
014import com.microsoft.thrifty.util.ProtocolUtil;
015import java.io.IOException;
016import java.util.ArrayList;
017import java.util.Collections;
018import java.util.List;
019import javax.annotation.Generated;
020
021@Generated(
022    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
023    comments = "https://github.com/microsoft/thrifty"
024)
025public final class LockWakeupResponse implements Struct {
026  public static final Adapter<LockWakeupResponse, Builder> ADAPTER = new LockWakeupResponseAdapter();
027
028  @ThriftField(
029      fieldId = 1,
030      isOptional = true
031  )
032  public final DeviceBean deviceBean;
033
034  @ThriftField(
035      fieldId = 2,
036      isOptional = true
037  )
038  public final String iso8601Timestamp;
039
040  @ThriftField(
041      fieldId = 3,
042      isOptional = true
043  )
044  public final List<PersonSummary> persons;
045
046  @ThriftField(
047      fieldId = 4,
048      isOptional = true
049  )
050  public final Token token;
051
052  private LockWakeupResponse(Builder builder) {
053    this.deviceBean = builder.deviceBean;
054    this.iso8601Timestamp = builder.iso8601Timestamp;
055    this.persons = builder.persons == null ? null : Collections.unmodifiableList(builder.persons);
056    this.token = builder.token;
057  }
058
059  @Override
060  @SuppressWarnings("StringEquality")
061  public boolean equals(Object other) {
062    if (this == other) return true;
063    if (other == null) return false;
064    if (!(other instanceof LockWakeupResponse)) return false;
065    LockWakeupResponse that = (LockWakeupResponse) other;
066    return (this.deviceBean == that.deviceBean || (this.deviceBean != null && this.deviceBean.equals(that.deviceBean)))
067        && (this.iso8601Timestamp == that.iso8601Timestamp || (this.iso8601Timestamp != null && this.iso8601Timestamp.equals(that.iso8601Timestamp)))
068        && (this.persons == that.persons || (this.persons != null && this.persons.equals(that.persons)))
069        && (this.token == that.token || (this.token != null && this.token.equals(that.token)));
070  }
071
072  @Override
073  public int hashCode() {
074    int code = 16777619;
075    code ^= (this.deviceBean == null) ? 0 : this.deviceBean.hashCode();
076    code *= 0x811c9dc5;
077    code ^= (this.iso8601Timestamp == null) ? 0 : this.iso8601Timestamp.hashCode();
078    code *= 0x811c9dc5;
079    code ^= (this.persons == null) ? 0 : this.persons.hashCode();
080    code *= 0x811c9dc5;
081    code ^= (this.token == null) ? 0 : this.token.hashCode();
082    code *= 0x811c9dc5;
083    return code;
084  }
085
086  @Override
087  public String toString() {
088    return "LockWakeupResponse{deviceBean=" + this.deviceBean + ", iso8601Timestamp=" + this.iso8601Timestamp + ", persons=" + this.persons + ", token=" + this.token + "}";
089  }
090
091  @Override
092  public void write(Protocol protocol) throws IOException {
093    ADAPTER.write(protocol, this);
094  }
095
096  public static final class Builder implements StructBuilder<LockWakeupResponse> {
097    private DeviceBean deviceBean;
098
099    private String iso8601Timestamp;
100
101    private List<PersonSummary> persons;
102
103    private Token token;
104
105    public Builder() {
106    }
107
108    public Builder(LockWakeupResponse struct) {
109      this.deviceBean = struct.deviceBean;
110      this.iso8601Timestamp = struct.iso8601Timestamp;
111      this.persons = struct.persons;
112      this.token = struct.token;
113    }
114
115    public Builder deviceBean(DeviceBean deviceBean) {
116      this.deviceBean = deviceBean;
117      return this;
118    }
119
120    public Builder iso8601Timestamp(String iso8601Timestamp) {
121      this.iso8601Timestamp = iso8601Timestamp;
122      return this;
123    }
124
125    public Builder persons(List<PersonSummary> persons) {
126      this.persons = persons;
127      return this;
128    }
129
130    public Builder token(Token token) {
131      this.token = token;
132      return this;
133    }
134
135    @Override
136    public LockWakeupResponse build() {
137      return new LockWakeupResponse(this);
138    }
139
140    @Override
141    public void reset() {
142      this.deviceBean = null;
143      this.iso8601Timestamp = null;
144      this.persons = null;
145      this.token = null;
146    }
147  }
148
149  private static final class LockWakeupResponseAdapter implements Adapter<LockWakeupResponse, Builder> {
150    @Override
151    public void write(Protocol protocol, LockWakeupResponse struct) throws IOException {
152      protocol.writeStructBegin("LockWakeupResponse");
153      if (struct.deviceBean != null) {
154        protocol.writeFieldBegin("deviceBean", 1, TType.STRUCT);
155        net.gdface.facelog.client.thrift.DeviceBean.ADAPTER.write(protocol, struct.deviceBean);
156        protocol.writeFieldEnd();
157      }
158      if (struct.iso8601Timestamp != null) {
159        protocol.writeFieldBegin("iso8601Timestamp", 2, TType.STRING);
160        protocol.writeString(struct.iso8601Timestamp);
161        protocol.writeFieldEnd();
162      }
163      if (struct.persons != null) {
164        protocol.writeFieldBegin("persons", 3, TType.LIST);
165        protocol.writeListBegin(TType.STRUCT, struct.persons.size());
166        for (PersonSummary item0 : struct.persons) {
167          net.gdface.facelog.client.thrift.PersonSummary.ADAPTER.write(protocol, item0);
168        }
169        protocol.writeListEnd();
170        protocol.writeFieldEnd();
171      }
172      if (struct.token != null) {
173        protocol.writeFieldBegin("token", 4, TType.STRUCT);
174        net.gdface.facelog.client.thrift.Token.ADAPTER.write(protocol, struct.token);
175        protocol.writeFieldEnd();
176      }
177      protocol.writeFieldStop();
178      protocol.writeStructEnd();
179    }
180
181    @Override
182    public LockWakeupResponse read(Protocol protocol, Builder builder) throws IOException {
183      protocol.readStructBegin();
184      while (true) {
185        FieldMetadata field = protocol.readFieldBegin();
186        if (field.typeId == TType.STOP) {
187          break;
188        }
189        switch (field.fieldId) {
190          case 1: {
191            if (field.typeId == TType.STRUCT) {
192              net.gdface.facelog.client.thrift.DeviceBean value = net.gdface.facelog.client.thrift.DeviceBean.ADAPTER.read(protocol);
193              builder.deviceBean(value);
194            } else {
195              ProtocolUtil.skip(protocol, field.typeId);
196            }
197          }
198          break;
199          case 2: {
200            if (field.typeId == TType.STRING) {
201              String value = protocol.readString();
202              builder.iso8601Timestamp(value);
203            } else {
204              ProtocolUtil.skip(protocol, field.typeId);
205            }
206          }
207          break;
208          case 3: {
209            if (field.typeId == TType.LIST) {
210              ListMetadata listMetadata0 = protocol.readListBegin();
211              List<PersonSummary> value = new ArrayList<PersonSummary>(listMetadata0.size);
212              for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
213                net.gdface.facelog.client.thrift.PersonSummary item0 = net.gdface.facelog.client.thrift.PersonSummary.ADAPTER.read(protocol);
214                value.add(item0);
215              }
216              protocol.readListEnd();
217              builder.persons(value);
218            } else {
219              ProtocolUtil.skip(protocol, field.typeId);
220            }
221          }
222          break;
223          case 4: {
224            if (field.typeId == TType.STRUCT) {
225              net.gdface.facelog.client.thrift.Token value = net.gdface.facelog.client.thrift.Token.ADAPTER.read(protocol);
226              builder.token(value);
227            } else {
228              ProtocolUtil.skip(protocol, field.typeId);
229            }
230          }
231          break;
232          default: {
233            ProtocolUtil.skip(protocol, field.typeId);
234          }
235          break;
236        }
237        protocol.readFieldEnd();
238      }
239      protocol.readStructEnd();
240      return builder.build();
241    }
242
243    @Override
244    public LockWakeupResponse read(Protocol protocol) throws IOException {
245      return read(protocol, new Builder());
246    }
247  }
248}