001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2020-06-15T05:54:07.423Z 003// Source: J:\faceapi\faceapi-service\FeatureSe.thrift at 23:1 004package net.gdface.sdk.fse.thrift.client; 005 006import com.microsoft.thrifty.TType; 007import com.microsoft.thrifty.ThriftException; 008import com.microsoft.thrifty.protocol.FieldMetadata; 009import com.microsoft.thrifty.protocol.ListMetadata; 010import com.microsoft.thrifty.protocol.MessageMetadata; 011import com.microsoft.thrifty.protocol.Protocol; 012import com.microsoft.thrifty.service.AsyncClientBase; 013import com.microsoft.thrifty.service.MethodCall; 014import com.microsoft.thrifty.service.ServiceMethodCallback; 015import com.microsoft.thrifty.service.TMessageType; 016import com.microsoft.thrifty.util.ProtocolUtil; 017import java.io.IOException; 018import java.util.ArrayList; 019import java.util.List; 020import javax.annotation.Generated; 021import okio.ByteString; 022 023@Generated( 024 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 025 comments = "https://github.com/microsoft/thrifty" 026) 027public class FeatureSeClient extends AsyncClientBase implements FeatureSe { 028 public FeatureSeClient(Protocol protocol, AsyncClientBase.Listener listener) { 029 super(protocol, listener); 030 } 031 032 @Override 033 public void addFeatureToFse(ByteString featureId, ByteString feature, String imgMD5, 034 ServiceMethodCallback<Boolean> callback) { 035 this.enqueue(new AddFeatureToFseCall(featureId, feature, imgMD5, callback)); 036 } 037 038 @Override 039 public void addFeatureToFseWithAppId(ByteString featureId, ByteString feature, Long appid, 040 ServiceMethodCallback<Boolean> callback) { 041 this.enqueue(new AddFeatureToFseWithAppIdCall(featureId, feature, appid, callback)); 042 } 043 044 @Override 045 public void clearAllOfFse(ServiceMethodCallback<Void> callback) { 046 this.enqueue(new ClearAllOfFseCall(callback)); 047 } 048 049 @Override 050 public void getFeatureByHexFromFse(String featureId, ServiceMethodCallback<CodeBean> callback) { 051 this.enqueue(new GetFeatureByHexFromFseCall(featureId, callback)); 052 } 053 054 @Override 055 public void getFeatureFromFse(ByteString featureId, ServiceMethodCallback<CodeBean> callback) { 056 this.enqueue(new GetFeatureFromFseCall(featureId, callback)); 057 } 058 059 @Override 060 public void removeFeatureByHexFromFse(String featureId, ServiceMethodCallback<Boolean> callback) { 061 this.enqueue(new RemoveFeatureByHexFromFseCall(featureId, callback)); 062 } 063 064 @Override 065 public void removeFeatureFromFse(ByteString featureId, ServiceMethodCallback<Boolean> callback) { 066 this.enqueue(new RemoveFeatureFromFseCall(featureId, callback)); 067 } 068 069 @Override 070 public void searchCodeFromFse(ByteString code, Double sim, Integer rows, 071 ServiceMethodCallback<List<CodeBean>> callback) { 072 this.enqueue(new SearchCodeFromFseCall(code, sim, rows, callback)); 073 } 074 075 @Override 076 public void sizeOfFse(ServiceMethodCallback<Integer> callback) { 077 this.enqueue(new SizeOfFseCall(callback)); 078 } 079 080 private static final class AddFeatureToFseCall extends MethodCall<Boolean> { 081 private final ByteString featureId; 082 083 private final ByteString feature; 084 085 private final String imgMD5; 086 087 AddFeatureToFseCall(ByteString featureId, ByteString feature, String imgMD5, 088 ServiceMethodCallback<Boolean> callback) { 089 super("addFeatureToFse", TMessageType.CALL, callback); 090 this.featureId = featureId; 091 this.feature = feature; 092 this.imgMD5 = imgMD5; 093 } 094 095 @Override 096 protected void send(Protocol protocol) throws IOException { 097 protocol.writeStructBegin("args"); 098 if (this.featureId != null) { 099 protocol.writeFieldBegin("featureId", 1, TType.STRING); 100 protocol.writeBinary(this.featureId); 101 protocol.writeFieldEnd(); 102 } 103 if (this.feature != null) { 104 protocol.writeFieldBegin("feature", 2, TType.STRING); 105 protocol.writeBinary(this.feature); 106 protocol.writeFieldEnd(); 107 } 108 if (this.imgMD5 != null) { 109 protocol.writeFieldBegin("imgMD5", 3, TType.STRING); 110 protocol.writeString(this.imgMD5); 111 protocol.writeFieldEnd(); 112 } 113 protocol.writeFieldStop(); 114 protocol.writeStructEnd(); 115 } 116 117 @Override 118 protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception { 119 Boolean result = null; 120 ServiceRuntimeException ex1 = null; 121 protocol.readStructBegin(); 122 while (true) { 123 FieldMetadata field = protocol.readFieldBegin(); 124 if (field.typeId == TType.STOP) { 125 break; 126 } 127 switch (field.fieldId) { 128 case 0: { 129 if (field.typeId == TType.BOOL) { 130 boolean value = protocol.readBool(); 131 result = value; 132 } else { 133 ProtocolUtil.skip(protocol, field.typeId); 134 } 135 } 136 break; 137 case 1: { 138 if (field.typeId == TType.STRUCT) { 139 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 140 ex1 = value; 141 } else { 142 ProtocolUtil.skip(protocol, field.typeId); 143 } 144 } 145 break; 146 default: ProtocolUtil.skip(protocol, field.typeId); break; 147 } 148 protocol.readFieldEnd(); 149 } 150 protocol.readStructEnd(); 151 if (result != null) { 152 return result; 153 } else if (ex1 != null) { 154 throw ex1; 155 } else { 156 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 157 } 158 } 159 } 160 161 private static final class AddFeatureToFseWithAppIdCall extends MethodCall<Boolean> { 162 private final ByteString featureId; 163 164 private final ByteString feature; 165 166 private final Long appid; 167 168 AddFeatureToFseWithAppIdCall(ByteString featureId, ByteString feature, Long appid, 169 ServiceMethodCallback<Boolean> callback) { 170 super("addFeatureToFseWithAppId", TMessageType.CALL, callback); 171 this.featureId = featureId; 172 this.feature = feature; 173 if (appid == null) throw new NullPointerException("appid"); 174 this.appid = appid; 175 } 176 177 @Override 178 protected void send(Protocol protocol) throws IOException { 179 protocol.writeStructBegin("args"); 180 if (this.featureId != null) { 181 protocol.writeFieldBegin("featureId", 1, TType.STRING); 182 protocol.writeBinary(this.featureId); 183 protocol.writeFieldEnd(); 184 } 185 if (this.feature != null) { 186 protocol.writeFieldBegin("feature", 2, TType.STRING); 187 protocol.writeBinary(this.feature); 188 protocol.writeFieldEnd(); 189 } 190 protocol.writeFieldBegin("appid", 3, TType.I64); 191 protocol.writeI64(this.appid); 192 protocol.writeFieldEnd(); 193 protocol.writeFieldStop(); 194 protocol.writeStructEnd(); 195 } 196 197 @Override 198 protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception { 199 Boolean result = null; 200 ServiceRuntimeException ex1 = null; 201 protocol.readStructBegin(); 202 while (true) { 203 FieldMetadata field = protocol.readFieldBegin(); 204 if (field.typeId == TType.STOP) { 205 break; 206 } 207 switch (field.fieldId) { 208 case 0: { 209 if (field.typeId == TType.BOOL) { 210 boolean value = protocol.readBool(); 211 result = value; 212 } else { 213 ProtocolUtil.skip(protocol, field.typeId); 214 } 215 } 216 break; 217 case 1: { 218 if (field.typeId == TType.STRUCT) { 219 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 220 ex1 = value; 221 } else { 222 ProtocolUtil.skip(protocol, field.typeId); 223 } 224 } 225 break; 226 default: ProtocolUtil.skip(protocol, field.typeId); break; 227 } 228 protocol.readFieldEnd(); 229 } 230 protocol.readStructEnd(); 231 if (result != null) { 232 return result; 233 } else if (ex1 != null) { 234 throw ex1; 235 } else { 236 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 237 } 238 } 239 } 240 241 private static final class ClearAllOfFseCall extends MethodCall<Void> { 242 ClearAllOfFseCall(ServiceMethodCallback<Void> callback) { 243 super("clearAllOfFse", TMessageType.CALL, callback); 244 } 245 246 @Override 247 protected void send(Protocol protocol) throws IOException { 248 protocol.writeStructBegin("args"); 249 protocol.writeFieldStop(); 250 protocol.writeStructEnd(); 251 } 252 253 @Override 254 protected Void receive(Protocol protocol, MessageMetadata metadata) throws Exception { 255 ServiceRuntimeException ex1 = null; 256 protocol.readStructBegin(); 257 while (true) { 258 FieldMetadata field = protocol.readFieldBegin(); 259 if (field.typeId == TType.STOP) { 260 break; 261 } 262 switch (field.fieldId) { 263 case 1: { 264 if (field.typeId == TType.STRUCT) { 265 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 266 ex1 = value; 267 } else { 268 ProtocolUtil.skip(protocol, field.typeId); 269 } 270 } 271 break; 272 default: ProtocolUtil.skip(protocol, field.typeId); break; 273 } 274 protocol.readFieldEnd(); 275 } 276 protocol.readStructEnd(); 277 if (ex1 != null) { 278 throw ex1; 279 } else { 280 return null; 281 } 282 } 283 } 284 285 private static final class GetFeatureByHexFromFseCall extends MethodCall<CodeBean> { 286 private final String featureId; 287 288 GetFeatureByHexFromFseCall(String featureId, ServiceMethodCallback<CodeBean> callback) { 289 super("getFeatureByHexFromFse", TMessageType.CALL, callback); 290 this.featureId = featureId; 291 } 292 293 @Override 294 protected void send(Protocol protocol) throws IOException { 295 protocol.writeStructBegin("args"); 296 if (this.featureId != null) { 297 protocol.writeFieldBegin("featureId", 1, TType.STRING); 298 protocol.writeString(this.featureId); 299 protocol.writeFieldEnd(); 300 } 301 protocol.writeFieldStop(); 302 protocol.writeStructEnd(); 303 } 304 305 @Override 306 protected CodeBean receive(Protocol protocol, MessageMetadata metadata) throws Exception { 307 CodeBean result = null; 308 ServiceRuntimeException ex1 = null; 309 protocol.readStructBegin(); 310 while (true) { 311 FieldMetadata field = protocol.readFieldBegin(); 312 if (field.typeId == TType.STOP) { 313 break; 314 } 315 switch (field.fieldId) { 316 case 0: { 317 if (field.typeId == TType.STRUCT) { 318 net.gdface.sdk.fse.thrift.client.CodeBean value = net.gdface.sdk.fse.thrift.client.CodeBean.ADAPTER.read(protocol); 319 result = value; 320 } else { 321 ProtocolUtil.skip(protocol, field.typeId); 322 } 323 } 324 break; 325 case 1: { 326 if (field.typeId == TType.STRUCT) { 327 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 328 ex1 = value; 329 } else { 330 ProtocolUtil.skip(protocol, field.typeId); 331 } 332 } 333 break; 334 default: ProtocolUtil.skip(protocol, field.typeId); break; 335 } 336 protocol.readFieldEnd(); 337 } 338 protocol.readStructEnd(); 339 if (result != null) { 340 return result; 341 } else if (ex1 != null) { 342 throw ex1; 343 } else { 344 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 345 } 346 } 347 } 348 349 private static final class GetFeatureFromFseCall extends MethodCall<CodeBean> { 350 private final ByteString featureId; 351 352 GetFeatureFromFseCall(ByteString featureId, ServiceMethodCallback<CodeBean> callback) { 353 super("getFeatureFromFse", TMessageType.CALL, callback); 354 this.featureId = featureId; 355 } 356 357 @Override 358 protected void send(Protocol protocol) throws IOException { 359 protocol.writeStructBegin("args"); 360 if (this.featureId != null) { 361 protocol.writeFieldBegin("featureId", 1, TType.STRING); 362 protocol.writeBinary(this.featureId); 363 protocol.writeFieldEnd(); 364 } 365 protocol.writeFieldStop(); 366 protocol.writeStructEnd(); 367 } 368 369 @Override 370 protected CodeBean receive(Protocol protocol, MessageMetadata metadata) throws Exception { 371 CodeBean result = null; 372 ServiceRuntimeException ex1 = null; 373 protocol.readStructBegin(); 374 while (true) { 375 FieldMetadata field = protocol.readFieldBegin(); 376 if (field.typeId == TType.STOP) { 377 break; 378 } 379 switch (field.fieldId) { 380 case 0: { 381 if (field.typeId == TType.STRUCT) { 382 net.gdface.sdk.fse.thrift.client.CodeBean value = net.gdface.sdk.fse.thrift.client.CodeBean.ADAPTER.read(protocol); 383 result = value; 384 } else { 385 ProtocolUtil.skip(protocol, field.typeId); 386 } 387 } 388 break; 389 case 1: { 390 if (field.typeId == TType.STRUCT) { 391 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 392 ex1 = value; 393 } else { 394 ProtocolUtil.skip(protocol, field.typeId); 395 } 396 } 397 break; 398 default: ProtocolUtil.skip(protocol, field.typeId); break; 399 } 400 protocol.readFieldEnd(); 401 } 402 protocol.readStructEnd(); 403 if (result != null) { 404 return result; 405 } else if (ex1 != null) { 406 throw ex1; 407 } else { 408 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 409 } 410 } 411 } 412 413 private static final class RemoveFeatureByHexFromFseCall extends MethodCall<Boolean> { 414 private final String featureId; 415 416 RemoveFeatureByHexFromFseCall(String featureId, ServiceMethodCallback<Boolean> callback) { 417 super("removeFeatureByHexFromFse", TMessageType.CALL, callback); 418 this.featureId = featureId; 419 } 420 421 @Override 422 protected void send(Protocol protocol) throws IOException { 423 protocol.writeStructBegin("args"); 424 if (this.featureId != null) { 425 protocol.writeFieldBegin("featureId", 1, TType.STRING); 426 protocol.writeString(this.featureId); 427 protocol.writeFieldEnd(); 428 } 429 protocol.writeFieldStop(); 430 protocol.writeStructEnd(); 431 } 432 433 @Override 434 protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception { 435 Boolean result = null; 436 ServiceRuntimeException ex1 = null; 437 protocol.readStructBegin(); 438 while (true) { 439 FieldMetadata field = protocol.readFieldBegin(); 440 if (field.typeId == TType.STOP) { 441 break; 442 } 443 switch (field.fieldId) { 444 case 0: { 445 if (field.typeId == TType.BOOL) { 446 boolean value = protocol.readBool(); 447 result = value; 448 } else { 449 ProtocolUtil.skip(protocol, field.typeId); 450 } 451 } 452 break; 453 case 1: { 454 if (field.typeId == TType.STRUCT) { 455 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 456 ex1 = value; 457 } else { 458 ProtocolUtil.skip(protocol, field.typeId); 459 } 460 } 461 break; 462 default: ProtocolUtil.skip(protocol, field.typeId); break; 463 } 464 protocol.readFieldEnd(); 465 } 466 protocol.readStructEnd(); 467 if (result != null) { 468 return result; 469 } else if (ex1 != null) { 470 throw ex1; 471 } else { 472 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 473 } 474 } 475 } 476 477 private static final class RemoveFeatureFromFseCall extends MethodCall<Boolean> { 478 private final ByteString featureId; 479 480 RemoveFeatureFromFseCall(ByteString featureId, ServiceMethodCallback<Boolean> callback) { 481 super("removeFeatureFromFse", TMessageType.CALL, callback); 482 this.featureId = featureId; 483 } 484 485 @Override 486 protected void send(Protocol protocol) throws IOException { 487 protocol.writeStructBegin("args"); 488 if (this.featureId != null) { 489 protocol.writeFieldBegin("featureId", 1, TType.STRING); 490 protocol.writeBinary(this.featureId); 491 protocol.writeFieldEnd(); 492 } 493 protocol.writeFieldStop(); 494 protocol.writeStructEnd(); 495 } 496 497 @Override 498 protected Boolean receive(Protocol protocol, MessageMetadata metadata) throws Exception { 499 Boolean result = null; 500 ServiceRuntimeException ex1 = null; 501 protocol.readStructBegin(); 502 while (true) { 503 FieldMetadata field = protocol.readFieldBegin(); 504 if (field.typeId == TType.STOP) { 505 break; 506 } 507 switch (field.fieldId) { 508 case 0: { 509 if (field.typeId == TType.BOOL) { 510 boolean value = protocol.readBool(); 511 result = value; 512 } else { 513 ProtocolUtil.skip(protocol, field.typeId); 514 } 515 } 516 break; 517 case 1: { 518 if (field.typeId == TType.STRUCT) { 519 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 520 ex1 = value; 521 } else { 522 ProtocolUtil.skip(protocol, field.typeId); 523 } 524 } 525 break; 526 default: ProtocolUtil.skip(protocol, field.typeId); break; 527 } 528 protocol.readFieldEnd(); 529 } 530 protocol.readStructEnd(); 531 if (result != null) { 532 return result; 533 } else if (ex1 != null) { 534 throw ex1; 535 } else { 536 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 537 } 538 } 539 } 540 541 private static final class SearchCodeFromFseCall extends MethodCall<List<CodeBean>> { 542 private final ByteString code; 543 544 private final Double sim; 545 546 private final Integer rows; 547 548 SearchCodeFromFseCall(ByteString code, Double sim, Integer rows, 549 ServiceMethodCallback<List<CodeBean>> callback) { 550 super("searchCodeFromFse", TMessageType.CALL, callback); 551 this.code = code; 552 if (sim == null) throw new NullPointerException("sim"); 553 this.sim = sim; 554 if (rows == null) throw new NullPointerException("rows"); 555 this.rows = rows; 556 } 557 558 @Override 559 protected void send(Protocol protocol) throws IOException { 560 protocol.writeStructBegin("args"); 561 if (this.code != null) { 562 protocol.writeFieldBegin("code", 1, TType.STRING); 563 protocol.writeBinary(this.code); 564 protocol.writeFieldEnd(); 565 } 566 protocol.writeFieldBegin("sim", 2, TType.DOUBLE); 567 protocol.writeDouble(this.sim); 568 protocol.writeFieldEnd(); 569 protocol.writeFieldBegin("rows", 3, TType.I32); 570 protocol.writeI32(this.rows); 571 protocol.writeFieldEnd(); 572 protocol.writeFieldStop(); 573 protocol.writeStructEnd(); 574 } 575 576 @Override 577 protected List<CodeBean> receive(Protocol protocol, MessageMetadata metadata) throws Exception { 578 List<CodeBean> result = null; 579 ServiceRuntimeException ex1 = null; 580 protocol.readStructBegin(); 581 while (true) { 582 FieldMetadata field = protocol.readFieldBegin(); 583 if (field.typeId == TType.STOP) { 584 break; 585 } 586 switch (field.fieldId) { 587 case 0: { 588 if (field.typeId == TType.LIST) { 589 ListMetadata listMetadata0 = protocol.readListBegin(); 590 List<CodeBean> value = new ArrayList<CodeBean>(listMetadata0.size); 591 for (int i0 = 0; i0 < listMetadata0.size; ++i0) { 592 net.gdface.sdk.fse.thrift.client.CodeBean item0 = net.gdface.sdk.fse.thrift.client.CodeBean.ADAPTER.read(protocol); 593 value.add(item0); 594 } 595 protocol.readListEnd(); 596 result = value; 597 } else { 598 ProtocolUtil.skip(protocol, field.typeId); 599 } 600 } 601 break; 602 case 1: { 603 if (field.typeId == TType.STRUCT) { 604 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 605 ex1 = value; 606 } else { 607 ProtocolUtil.skip(protocol, field.typeId); 608 } 609 } 610 break; 611 default: ProtocolUtil.skip(protocol, field.typeId); break; 612 } 613 protocol.readFieldEnd(); 614 } 615 protocol.readStructEnd(); 616 if (result != null) { 617 return result; 618 } else if (ex1 != null) { 619 throw ex1; 620 } else { 621 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 622 } 623 } 624 } 625 626 private static final class SizeOfFseCall extends MethodCall<Integer> { 627 SizeOfFseCall(ServiceMethodCallback<Integer> callback) { 628 super("sizeOfFse", TMessageType.CALL, callback); 629 } 630 631 @Override 632 protected void send(Protocol protocol) throws IOException { 633 protocol.writeStructBegin("args"); 634 protocol.writeFieldStop(); 635 protocol.writeStructEnd(); 636 } 637 638 @Override 639 protected Integer receive(Protocol protocol, MessageMetadata metadata) throws Exception { 640 Integer result = null; 641 ServiceRuntimeException ex1 = null; 642 protocol.readStructBegin(); 643 while (true) { 644 FieldMetadata field = protocol.readFieldBegin(); 645 if (field.typeId == TType.STOP) { 646 break; 647 } 648 switch (field.fieldId) { 649 case 0: { 650 if (field.typeId == TType.I32) { 651 int value = protocol.readI32(); 652 result = value; 653 } else { 654 ProtocolUtil.skip(protocol, field.typeId); 655 } 656 } 657 break; 658 case 1: { 659 if (field.typeId == TType.STRUCT) { 660 net.gdface.sdk.fse.thrift.client.ServiceRuntimeException value = net.gdface.sdk.fse.thrift.client.ServiceRuntimeException.ADAPTER.read(protocol); 661 ex1 = value; 662 } else { 663 ProtocolUtil.skip(protocol, field.typeId); 664 } 665 } 666 break; 667 default: ProtocolUtil.skip(protocol, field.typeId); break; 668 } 669 protocol.readFieldEnd(); 670 } 671 protocol.readStructEnd(); 672 if (result != null) { 673 return result; 674 } else if (ex1 != null) { 675 throw ex1; 676 } else { 677 throw new ThriftException(ThriftException.Kind.MISSING_RESULT, "Missing result"); 678 } 679 } 680 } 681}