001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2021-05-17T06:20:27.414Z
003// Source: J:\facedb\facedb-service\FaceDb.thrift at 18: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 EyeInfo implements Struct {
022  public static final Adapter<EyeInfo, Builder> ADAPTER = new EyeInfoAdapter();
023
024  @ThriftField(
025      fieldId = 1,
026      isRequired = true
027  )
028  public final Integer leftx;
029
030  @ThriftField(
031      fieldId = 2,
032      isRequired = true
033  )
034  public final Integer lefty;
035
036  @ThriftField(
037      fieldId = 3,
038      isRequired = true
039  )
040  public final Integer rightx;
041
042  @ThriftField(
043      fieldId = 4,
044      isRequired = true
045  )
046  public final Integer righty;
047
048  private EyeInfo(Builder builder) {
049    this.leftx = builder.leftx;
050    this.lefty = builder.lefty;
051    this.rightx = builder.rightx;
052    this.righty = builder.righty;
053  }
054
055  @Override
056  @SuppressWarnings("NumberEquality")
057  public boolean equals(Object other) {
058    if (this == other) return true;
059    if (other == null) return false;
060    if (!(other instanceof EyeInfo)) return false;
061    EyeInfo that = (EyeInfo) other;
062    return (this.leftx == that.leftx || this.leftx.equals(that.leftx))
063        && (this.lefty == that.lefty || this.lefty.equals(that.lefty))
064        && (this.rightx == that.rightx || this.rightx.equals(that.rightx))
065        && (this.righty == that.righty || this.righty.equals(that.righty));
066  }
067
068  @Override
069  public int hashCode() {
070    int code = 16777619;
071    code ^= this.leftx.hashCode();
072    code *= 0x811c9dc5;
073    code ^= this.lefty.hashCode();
074    code *= 0x811c9dc5;
075    code ^= this.rightx.hashCode();
076    code *= 0x811c9dc5;
077    code ^= this.righty.hashCode();
078    code *= 0x811c9dc5;
079    return code;
080  }
081
082  @Override
083  public String toString() {
084    return "EyeInfo{leftx=" + this.leftx + ", lefty=" + this.lefty + ", rightx=" + this.rightx + ", righty=" + this.righty + "}";
085  }
086
087  @Override
088  public void write(Protocol protocol) throws IOException {
089    ADAPTER.write(protocol, this);
090  }
091
092  public static final class Builder implements StructBuilder<EyeInfo> {
093    private Integer leftx;
094
095    private Integer lefty;
096
097    private Integer rightx;
098
099    private Integer righty;
100
101    public Builder() {
102    }
103
104    public Builder(EyeInfo struct) {
105      this.leftx = struct.leftx;
106      this.lefty = struct.lefty;
107      this.rightx = struct.rightx;
108      this.righty = struct.righty;
109    }
110
111    public Builder leftx(Integer leftx) {
112      if (leftx == null) {
113        throw new NullPointerException("Required field 'leftx' cannot be null");
114      }
115      this.leftx = leftx;
116      return this;
117    }
118
119    public Builder lefty(Integer lefty) {
120      if (lefty == null) {
121        throw new NullPointerException("Required field 'lefty' cannot be null");
122      }
123      this.lefty = lefty;
124      return this;
125    }
126
127    public Builder rightx(Integer rightx) {
128      if (rightx == null) {
129        throw new NullPointerException("Required field 'rightx' cannot be null");
130      }
131      this.rightx = rightx;
132      return this;
133    }
134
135    public Builder righty(Integer righty) {
136      if (righty == null) {
137        throw new NullPointerException("Required field 'righty' cannot be null");
138      }
139      this.righty = righty;
140      return this;
141    }
142
143    @Override
144    public EyeInfo build() {
145      if (this.leftx == null) {
146        throw new IllegalStateException("Required field 'leftx' is missing");
147      }
148      if (this.lefty == null) {
149        throw new IllegalStateException("Required field 'lefty' is missing");
150      }
151      if (this.rightx == null) {
152        throw new IllegalStateException("Required field 'rightx' is missing");
153      }
154      if (this.righty == null) {
155        throw new IllegalStateException("Required field 'righty' is missing");
156      }
157      return new EyeInfo(this);
158    }
159
160    @Override
161    public void reset() {
162      this.leftx = null;
163      this.lefty = null;
164      this.rightx = null;
165      this.righty = null;
166    }
167  }
168
169  private static final class EyeInfoAdapter implements Adapter<EyeInfo, Builder> {
170    @Override
171    public void write(Protocol protocol, EyeInfo struct) throws IOException {
172      protocol.writeStructBegin("EyeInfo");
173      protocol.writeFieldBegin("leftx", 1, TType.I32);
174      protocol.writeI32(struct.leftx);
175      protocol.writeFieldEnd();
176      protocol.writeFieldBegin("lefty", 2, TType.I32);
177      protocol.writeI32(struct.lefty);
178      protocol.writeFieldEnd();
179      protocol.writeFieldBegin("rightx", 3, TType.I32);
180      protocol.writeI32(struct.rightx);
181      protocol.writeFieldEnd();
182      protocol.writeFieldBegin("righty", 4, TType.I32);
183      protocol.writeI32(struct.righty);
184      protocol.writeFieldEnd();
185      protocol.writeFieldStop();
186      protocol.writeStructEnd();
187    }
188
189    @Override
190    public EyeInfo read(Protocol protocol, Builder builder) throws IOException {
191      protocol.readStructBegin();
192      while (true) {
193        FieldMetadata field = protocol.readFieldBegin();
194        if (field.typeId == TType.STOP) {
195          break;
196        }
197        switch (field.fieldId) {
198          case 1: {
199            if (field.typeId == TType.I32) {
200              int value = protocol.readI32();
201              builder.leftx(value);
202            } else {
203              ProtocolUtil.skip(protocol, field.typeId);
204            }
205          }
206          break;
207          case 2: {
208            if (field.typeId == TType.I32) {
209              int value = protocol.readI32();
210              builder.lefty(value);
211            } else {
212              ProtocolUtil.skip(protocol, field.typeId);
213            }
214          }
215          break;
216          case 3: {
217            if (field.typeId == TType.I32) {
218              int value = protocol.readI32();
219              builder.rightx(value);
220            } else {
221              ProtocolUtil.skip(protocol, field.typeId);
222            }
223          }
224          break;
225          case 4: {
226            if (field.typeId == TType.I32) {
227              int value = protocol.readI32();
228              builder.righty(value);
229            } else {
230              ProtocolUtil.skip(protocol, field.typeId);
231            }
232          }
233          break;
234          default: {
235            ProtocolUtil.skip(protocol, field.typeId);
236          }
237          break;
238        }
239        protocol.readFieldEnd();
240      }
241      protocol.readStructEnd();
242      return builder.build();
243    }
244
245    @Override
246    public EyeInfo read(Protocol protocol) throws IOException {
247      return read(protocol, new Builder());
248    }
249  }
250}