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