001// Automatically generated by the Thrifty compiler; do not edit!
002// Generated on: 2020-11-05T09:22:38.129Z
003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 264: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.ThriftException;
011import com.microsoft.thrifty.ThriftField;
012import com.microsoft.thrifty.protocol.FieldMetadata;
013import com.microsoft.thrifty.protocol.Protocol;
014import com.microsoft.thrifty.util.ProtocolUtil;
015import java.io.IOException;
016import javax.annotation.Generated;
017
018@Generated(
019    value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
020    comments = "https://github.com/microsoft/thrifty"
021)
022public final class ServiceSecurityException extends Exception implements Struct {
023  public static final Adapter<ServiceSecurityException, Builder> ADAPTER = new ServiceSecurityExceptionAdapter();
024
025  @ThriftField(
026      fieldId = 1,
027      isOptional = true
028  )
029  public final String message;
030
031  @ThriftField(
032      fieldId = 2,
033      isOptional = true
034  )
035  public final String causeClass;
036
037  @ThriftField(
038      fieldId = 3,
039      isOptional = true
040  )
041  public final String serviceStackTraceMessage;
042
043  @ThriftField(
044      fieldId = 4,
045      isOptional = true
046  )
047  public final String causeFields;
048
049  @ThriftField(
050      fieldId = 5,
051      isOptional = true
052  )
053  public final Integer deviceID;
054
055  @ThriftField(
056      fieldId = 6,
057      isOptional = true
058  )
059  public final SecurityExceptionType type;
060
061  private ServiceSecurityException(Builder builder) {
062    this.message = builder.message;
063    this.causeClass = builder.causeClass;
064    this.serviceStackTraceMessage = builder.serviceStackTraceMessage;
065    this.causeFields = builder.causeFields;
066    this.deviceID = builder.deviceID;
067    this.type = builder.type;
068  }
069
070  @Override
071  @SuppressWarnings({"StringEquality", "NumberEquality"})
072  public boolean equals(Object other) {
073    if (this == other) return true;
074    if (other == null) return false;
075    if (!(other instanceof ServiceSecurityException)) return false;
076    ServiceSecurityException that = (ServiceSecurityException) other;
077    return (this.message == that.message || (this.message != null && this.message.equals(that.message)))
078        && (this.causeClass == that.causeClass || (this.causeClass != null && this.causeClass.equals(that.causeClass)))
079        && (this.serviceStackTraceMessage == that.serviceStackTraceMessage || (this.serviceStackTraceMessage != null && this.serviceStackTraceMessage.equals(that.serviceStackTraceMessage)))
080        && (this.causeFields == that.causeFields || (this.causeFields != null && this.causeFields.equals(that.causeFields)))
081        && (this.deviceID == that.deviceID || (this.deviceID != null && this.deviceID.equals(that.deviceID)))
082        && (this.type == that.type || (this.type != null && this.type.equals(that.type)));
083  }
084
085  @Override
086  public int hashCode() {
087    int code = 16777619;
088    code ^= (this.message == null) ? 0 : this.message.hashCode();
089    code *= 0x811c9dc5;
090    code ^= (this.causeClass == null) ? 0 : this.causeClass.hashCode();
091    code *= 0x811c9dc5;
092    code ^= (this.serviceStackTraceMessage == null) ? 0 : this.serviceStackTraceMessage.hashCode();
093    code *= 0x811c9dc5;
094    code ^= (this.causeFields == null) ? 0 : this.causeFields.hashCode();
095    code *= 0x811c9dc5;
096    code ^= (this.deviceID == null) ? 0 : this.deviceID.hashCode();
097    code *= 0x811c9dc5;
098    code ^= (this.type == null) ? 0 : this.type.hashCode();
099    code *= 0x811c9dc5;
100    return code;
101  }
102
103  @Override
104  public String toString() {
105    return "ServiceSecurityException{message=" + this.message + ", causeClass=" + this.causeClass + ", serviceStackTraceMessage=" + this.serviceStackTraceMessage + ", causeFields=" + this.causeFields + ", deviceID=" + this.deviceID + ", type=" + this.type + "}";
106  }
107
108  @Override
109  public void write(Protocol protocol) throws IOException {
110    ADAPTER.write(protocol, this);
111  }
112
113  public static final class Builder implements StructBuilder<ServiceSecurityException> {
114    private String message;
115
116    private String causeClass;
117
118    private String serviceStackTraceMessage;
119
120    private String causeFields;
121
122    private Integer deviceID;
123
124    private SecurityExceptionType type;
125
126    public Builder() {
127    }
128
129    public Builder(ServiceSecurityException struct) {
130      this.message = struct.message;
131      this.causeClass = struct.causeClass;
132      this.serviceStackTraceMessage = struct.serviceStackTraceMessage;
133      this.causeFields = struct.causeFields;
134      this.deviceID = struct.deviceID;
135      this.type = struct.type;
136    }
137
138    public Builder message(String message) {
139      this.message = message;
140      return this;
141    }
142
143    public Builder causeClass(String causeClass) {
144      this.causeClass = causeClass;
145      return this;
146    }
147
148    public Builder serviceStackTraceMessage(String serviceStackTraceMessage) {
149      this.serviceStackTraceMessage = serviceStackTraceMessage;
150      return this;
151    }
152
153    public Builder causeFields(String causeFields) {
154      this.causeFields = causeFields;
155      return this;
156    }
157
158    public Builder deviceID(Integer deviceID) {
159      this.deviceID = deviceID;
160      return this;
161    }
162
163    public Builder type(SecurityExceptionType type) {
164      this.type = type;
165      return this;
166    }
167
168    @Override
169    public ServiceSecurityException build() {
170      return new ServiceSecurityException(this);
171    }
172
173    @Override
174    public void reset() {
175      this.message = null;
176      this.causeClass = null;
177      this.serviceStackTraceMessage = null;
178      this.causeFields = null;
179      this.deviceID = null;
180      this.type = null;
181    }
182  }
183
184  private static final class ServiceSecurityExceptionAdapter implements Adapter<ServiceSecurityException, Builder> {
185    @Override
186    public void write(Protocol protocol, ServiceSecurityException struct) throws IOException {
187      protocol.writeStructBegin("ServiceSecurityException");
188      if (struct.message != null) {
189        protocol.writeFieldBegin("message", 1, TType.STRING);
190        protocol.writeString(struct.message);
191        protocol.writeFieldEnd();
192      }
193      if (struct.causeClass != null) {
194        protocol.writeFieldBegin("causeClass", 2, TType.STRING);
195        protocol.writeString(struct.causeClass);
196        protocol.writeFieldEnd();
197      }
198      if (struct.serviceStackTraceMessage != null) {
199        protocol.writeFieldBegin("serviceStackTraceMessage", 3, TType.STRING);
200        protocol.writeString(struct.serviceStackTraceMessage);
201        protocol.writeFieldEnd();
202      }
203      if (struct.causeFields != null) {
204        protocol.writeFieldBegin("causeFields", 4, TType.STRING);
205        protocol.writeString(struct.causeFields);
206        protocol.writeFieldEnd();
207      }
208      if (struct.deviceID != null) {
209        protocol.writeFieldBegin("deviceID", 5, TType.I32);
210        protocol.writeI32(struct.deviceID);
211        protocol.writeFieldEnd();
212      }
213      if (struct.type != null) {
214        protocol.writeFieldBegin("type", 6, TType.I32);
215        protocol.writeI32(struct.type.value);
216        protocol.writeFieldEnd();
217      }
218      protocol.writeFieldStop();
219      protocol.writeStructEnd();
220    }
221
222    @Override
223    public ServiceSecurityException read(Protocol protocol, Builder builder) throws IOException {
224      protocol.readStructBegin();
225      while (true) {
226        FieldMetadata field = protocol.readFieldBegin();
227        if (field.typeId == TType.STOP) {
228          break;
229        }
230        switch (field.fieldId) {
231          case 1: {
232            if (field.typeId == TType.STRING) {
233              String value = protocol.readString();
234              builder.message(value);
235            } else {
236              ProtocolUtil.skip(protocol, field.typeId);
237            }
238          }
239          break;
240          case 2: {
241            if (field.typeId == TType.STRING) {
242              String value = protocol.readString();
243              builder.causeClass(value);
244            } else {
245              ProtocolUtil.skip(protocol, field.typeId);
246            }
247          }
248          break;
249          case 3: {
250            if (field.typeId == TType.STRING) {
251              String value = protocol.readString();
252              builder.serviceStackTraceMessage(value);
253            } else {
254              ProtocolUtil.skip(protocol, field.typeId);
255            }
256          }
257          break;
258          case 4: {
259            if (field.typeId == TType.STRING) {
260              String value = protocol.readString();
261              builder.causeFields(value);
262            } else {
263              ProtocolUtil.skip(protocol, field.typeId);
264            }
265          }
266          break;
267          case 5: {
268            if (field.typeId == TType.I32) {
269              int value = protocol.readI32();
270              builder.deviceID(value);
271            } else {
272              ProtocolUtil.skip(protocol, field.typeId);
273            }
274          }
275          break;
276          case 6: {
277            if (field.typeId == TType.I32) {
278              int i32_0 = protocol.readI32();
279              net.gdface.facelog.client.thrift.SecurityExceptionType value = net.gdface.facelog.client.thrift.SecurityExceptionType.findByValue(i32_0);
280              if (value == null) {
281                throw new ThriftException(ThriftException.Kind.PROTOCOL_ERROR, "Unexpected value for enum-type SecurityExceptionType: " + i32_0);
282              }
283              builder.type(value);
284            } else {
285              ProtocolUtil.skip(protocol, field.typeId);
286            }
287          }
288          break;
289          default: {
290            ProtocolUtil.skip(protocol, field.typeId);
291          }
292          break;
293        }
294        protocol.readFieldEnd();
295      }
296      protocol.readStructEnd();
297      return builder.build();
298    }
299
300    @Override
301    public ServiceSecurityException read(Protocol protocol) throws IOException {
302      return read(protocol, new Builder());
303    }
304  }
305}