001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2021-05-17T06:20:27.424Z 003// Source: J:\facedb\facedb-service\FaceDb.thrift at 133: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; 016import okio.ByteString; 017 018@Generated( 019 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 020 comments = "https://github.com/microsoft/thrifty" 021) 022public final class CodeInfo implements Struct { 023 public static final Adapter<CodeInfo, Builder> ADAPTER = new CodeInfoAdapter(); 024 025 @ThriftField( 026 fieldId = 1, 027 isOptional = true 028 ) 029 public final FAngle angle; 030 031 @ThriftField( 032 fieldId = 2, 033 isOptional = true 034 ) 035 public final ByteString code; 036 037 @ThriftField( 038 fieldId = 3, 039 isOptional = true 040 ) 041 public final EyeInfo ei; 042 043 @ThriftField( 044 fieldId = 4, 045 isOptional = true 046 ) 047 public final ByteString facialData; 048 049 @ThriftField( 050 fieldId = 5, 051 isOptional = true 052 ) 053 public final FInt2 mouth; 054 055 @ThriftField( 056 fieldId = 6, 057 isOptional = true 058 ) 059 public final FInt2 nose; 060 061 @ThriftField( 062 fieldId = 7, 063 isOptional = true 064 ) 065 public final FInt2 offset; 066 067 @ThriftField( 068 fieldId = 8, 069 isOptional = true 070 ) 071 public final FRect pos; 072 073 @ThriftField( 074 fieldId = 9, 075 isRequired = true 076 ) 077 public final Integer rotate; 078 079 private CodeInfo(Builder builder) { 080 this.angle = builder.angle; 081 this.code = builder.code; 082 this.ei = builder.ei; 083 this.facialData = builder.facialData; 084 this.mouth = builder.mouth; 085 this.nose = builder.nose; 086 this.offset = builder.offset; 087 this.pos = builder.pos; 088 this.rotate = builder.rotate; 089 } 090 091 @Override 092 @SuppressWarnings("NumberEquality") 093 public boolean equals(Object other) { 094 if (this == other) return true; 095 if (other == null) return false; 096 if (!(other instanceof CodeInfo)) return false; 097 CodeInfo that = (CodeInfo) other; 098 return (this.angle == that.angle || (this.angle != null && this.angle.equals(that.angle))) 099 && (this.code == that.code || (this.code != null && this.code.equals(that.code))) 100 && (this.ei == that.ei || (this.ei != null && this.ei.equals(that.ei))) 101 && (this.facialData == that.facialData || (this.facialData != null && this.facialData.equals(that.facialData))) 102 && (this.mouth == that.mouth || (this.mouth != null && this.mouth.equals(that.mouth))) 103 && (this.nose == that.nose || (this.nose != null && this.nose.equals(that.nose))) 104 && (this.offset == that.offset || (this.offset != null && this.offset.equals(that.offset))) 105 && (this.pos == that.pos || (this.pos != null && this.pos.equals(that.pos))) 106 && (this.rotate == that.rotate || this.rotate.equals(that.rotate)); 107 } 108 109 @Override 110 public int hashCode() { 111 int code = 16777619; 112 code ^= (this.angle == null) ? 0 : this.angle.hashCode(); 113 code *= 0x811c9dc5; 114 code ^= (this.code == null) ? 0 : this.code.hashCode(); 115 code *= 0x811c9dc5; 116 code ^= (this.ei == null) ? 0 : this.ei.hashCode(); 117 code *= 0x811c9dc5; 118 code ^= (this.facialData == null) ? 0 : this.facialData.hashCode(); 119 code *= 0x811c9dc5; 120 code ^= (this.mouth == null) ? 0 : this.mouth.hashCode(); 121 code *= 0x811c9dc5; 122 code ^= (this.nose == null) ? 0 : this.nose.hashCode(); 123 code *= 0x811c9dc5; 124 code ^= (this.offset == null) ? 0 : this.offset.hashCode(); 125 code *= 0x811c9dc5; 126 code ^= (this.pos == null) ? 0 : this.pos.hashCode(); 127 code *= 0x811c9dc5; 128 code ^= this.rotate.hashCode(); 129 code *= 0x811c9dc5; 130 return code; 131 } 132 133 @Override 134 public String toString() { 135 return "CodeInfo{angle=" + this.angle + ", code=" + this.code + ", ei=" + this.ei + ", facialData=" + this.facialData + ", mouth=" + this.mouth + ", nose=" + this.nose + ", offset=" + this.offset + ", pos=" + this.pos + ", rotate=" + this.rotate + "}"; 136 } 137 138 @Override 139 public void write(Protocol protocol) throws IOException { 140 ADAPTER.write(protocol, this); 141 } 142 143 public static final class Builder implements StructBuilder<CodeInfo> { 144 private FAngle angle; 145 146 private ByteString code; 147 148 private EyeInfo ei; 149 150 private ByteString facialData; 151 152 private FInt2 mouth; 153 154 private FInt2 nose; 155 156 private FInt2 offset; 157 158 private FRect pos; 159 160 private Integer rotate; 161 162 public Builder() { 163 } 164 165 public Builder(CodeInfo struct) { 166 this.angle = struct.angle; 167 this.code = struct.code; 168 this.ei = struct.ei; 169 this.facialData = struct.facialData; 170 this.mouth = struct.mouth; 171 this.nose = struct.nose; 172 this.offset = struct.offset; 173 this.pos = struct.pos; 174 this.rotate = struct.rotate; 175 } 176 177 public Builder angle(FAngle angle) { 178 this.angle = angle; 179 return this; 180 } 181 182 public Builder code(ByteString code) { 183 this.code = code; 184 return this; 185 } 186 187 public Builder ei(EyeInfo ei) { 188 this.ei = ei; 189 return this; 190 } 191 192 public Builder facialData(ByteString facialData) { 193 this.facialData = facialData; 194 return this; 195 } 196 197 public Builder mouth(FInt2 mouth) { 198 this.mouth = mouth; 199 return this; 200 } 201 202 public Builder nose(FInt2 nose) { 203 this.nose = nose; 204 return this; 205 } 206 207 public Builder offset(FInt2 offset) { 208 this.offset = offset; 209 return this; 210 } 211 212 public Builder pos(FRect pos) { 213 this.pos = pos; 214 return this; 215 } 216 217 public Builder rotate(Integer rotate) { 218 if (rotate == null) { 219 throw new NullPointerException("Required field 'rotate' cannot be null"); 220 } 221 this.rotate = rotate; 222 return this; 223 } 224 225 @Override 226 public CodeInfo build() { 227 if (this.rotate == null) { 228 throw new IllegalStateException("Required field 'rotate' is missing"); 229 } 230 return new CodeInfo(this); 231 } 232 233 @Override 234 public void reset() { 235 this.angle = null; 236 this.code = null; 237 this.ei = null; 238 this.facialData = null; 239 this.mouth = null; 240 this.nose = null; 241 this.offset = null; 242 this.pos = null; 243 this.rotate = null; 244 } 245 } 246 247 private static final class CodeInfoAdapter implements Adapter<CodeInfo, Builder> { 248 @Override 249 public void write(Protocol protocol, CodeInfo struct) throws IOException { 250 protocol.writeStructBegin("CodeInfo"); 251 if (struct.angle != null) { 252 protocol.writeFieldBegin("angle", 1, TType.STRUCT); 253 net.gdface.facedb.thrift.client.FAngle.ADAPTER.write(protocol, struct.angle); 254 protocol.writeFieldEnd(); 255 } 256 if (struct.code != null) { 257 protocol.writeFieldBegin("code", 2, TType.STRING); 258 protocol.writeBinary(struct.code); 259 protocol.writeFieldEnd(); 260 } 261 if (struct.ei != null) { 262 protocol.writeFieldBegin("ei", 3, TType.STRUCT); 263 net.gdface.facedb.thrift.client.EyeInfo.ADAPTER.write(protocol, struct.ei); 264 protocol.writeFieldEnd(); 265 } 266 if (struct.facialData != null) { 267 protocol.writeFieldBegin("facialData", 4, TType.STRING); 268 protocol.writeBinary(struct.facialData); 269 protocol.writeFieldEnd(); 270 } 271 if (struct.mouth != null) { 272 protocol.writeFieldBegin("mouth", 5, TType.STRUCT); 273 net.gdface.facedb.thrift.client.FInt2.ADAPTER.write(protocol, struct.mouth); 274 protocol.writeFieldEnd(); 275 } 276 if (struct.nose != null) { 277 protocol.writeFieldBegin("nose", 6, TType.STRUCT); 278 net.gdface.facedb.thrift.client.FInt2.ADAPTER.write(protocol, struct.nose); 279 protocol.writeFieldEnd(); 280 } 281 if (struct.offset != null) { 282 protocol.writeFieldBegin("offset", 7, TType.STRUCT); 283 net.gdface.facedb.thrift.client.FInt2.ADAPTER.write(protocol, struct.offset); 284 protocol.writeFieldEnd(); 285 } 286 if (struct.pos != null) { 287 protocol.writeFieldBegin("pos", 8, TType.STRUCT); 288 net.gdface.facedb.thrift.client.FRect.ADAPTER.write(protocol, struct.pos); 289 protocol.writeFieldEnd(); 290 } 291 protocol.writeFieldBegin("rotate", 9, TType.I32); 292 protocol.writeI32(struct.rotate); 293 protocol.writeFieldEnd(); 294 protocol.writeFieldStop(); 295 protocol.writeStructEnd(); 296 } 297 298 @Override 299 public CodeInfo read(Protocol protocol, Builder builder) throws IOException { 300 protocol.readStructBegin(); 301 while (true) { 302 FieldMetadata field = protocol.readFieldBegin(); 303 if (field.typeId == TType.STOP) { 304 break; 305 } 306 switch (field.fieldId) { 307 case 1: { 308 if (field.typeId == TType.STRUCT) { 309 net.gdface.facedb.thrift.client.FAngle value = net.gdface.facedb.thrift.client.FAngle.ADAPTER.read(protocol); 310 builder.angle(value); 311 } else { 312 ProtocolUtil.skip(protocol, field.typeId); 313 } 314 } 315 break; 316 case 2: { 317 if (field.typeId == TType.STRING) { 318 ByteString value = protocol.readBinary(); 319 builder.code(value); 320 } else { 321 ProtocolUtil.skip(protocol, field.typeId); 322 } 323 } 324 break; 325 case 3: { 326 if (field.typeId == TType.STRUCT) { 327 net.gdface.facedb.thrift.client.EyeInfo value = net.gdface.facedb.thrift.client.EyeInfo.ADAPTER.read(protocol); 328 builder.ei(value); 329 } else { 330 ProtocolUtil.skip(protocol, field.typeId); 331 } 332 } 333 break; 334 case 4: { 335 if (field.typeId == TType.STRING) { 336 ByteString value = protocol.readBinary(); 337 builder.facialData(value); 338 } else { 339 ProtocolUtil.skip(protocol, field.typeId); 340 } 341 } 342 break; 343 case 5: { 344 if (field.typeId == TType.STRUCT) { 345 net.gdface.facedb.thrift.client.FInt2 value = net.gdface.facedb.thrift.client.FInt2.ADAPTER.read(protocol); 346 builder.mouth(value); 347 } else { 348 ProtocolUtil.skip(protocol, field.typeId); 349 } 350 } 351 break; 352 case 6: { 353 if (field.typeId == TType.STRUCT) { 354 net.gdface.facedb.thrift.client.FInt2 value = net.gdface.facedb.thrift.client.FInt2.ADAPTER.read(protocol); 355 builder.nose(value); 356 } else { 357 ProtocolUtil.skip(protocol, field.typeId); 358 } 359 } 360 break; 361 case 7: { 362 if (field.typeId == TType.STRUCT) { 363 net.gdface.facedb.thrift.client.FInt2 value = net.gdface.facedb.thrift.client.FInt2.ADAPTER.read(protocol); 364 builder.offset(value); 365 } else { 366 ProtocolUtil.skip(protocol, field.typeId); 367 } 368 } 369 break; 370 case 8: { 371 if (field.typeId == TType.STRUCT) { 372 net.gdface.facedb.thrift.client.FRect value = net.gdface.facedb.thrift.client.FRect.ADAPTER.read(protocol); 373 builder.pos(value); 374 } else { 375 ProtocolUtil.skip(protocol, field.typeId); 376 } 377 } 378 break; 379 case 9: { 380 if (field.typeId == TType.I32) { 381 int value = protocol.readI32(); 382 builder.rotate(value); 383 } else { 384 ProtocolUtil.skip(protocol, field.typeId); 385 } 386 } 387 break; 388 default: { 389 ProtocolUtil.skip(protocol, field.typeId); 390 } 391 break; 392 } 393 protocol.readFieldEnd(); 394 } 395 protocol.readStructEnd(); 396 return builder.build(); 397 } 398 399 @Override 400 public CodeInfo read(Protocol protocol) throws IOException { 401 return read(protocol, new Builder()); 402 } 403 } 404}