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