001// ______________________________________________________ 002// Generated by codegen - https://gitee.com/l0km/codegen 003// template: thrift/service/perservice/service.decorator.class.vm 004// ______________________________________________________ 005 006package net.gdface.sdk.decorator; 007import java.nio.ByteBuffer; 008import java.util.List; 009import java.util.Map; 010import net.gdface.image.MatType; 011import net.gdface.sdk.FaceApi; 012import net.gdface.thrift.TypeTransformer; 013import net.gdface.thrift.exception.ServiceRuntimeException; 014import com.facebook.swift.service.ThriftException; 015import com.facebook.swift.service.ThriftService; 016import com.facebook.swift.service.ThriftMethod; 017/** 018 * decorator pattern 装饰者模式代理{@link FaceApi}接口<br> 019 * 将{@link FaceApi}实例封装为一个thrift服务<br> 020 * 转发所有服务请求到{@link #delegate()}指定的实例<br> 021 * 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)<br> 022 * @author guyadong 023 * 024 */ 025@ThriftService("FaceApi") 026public class FaceApiThriftDecorator { 027 private final FaceApi delegate; 028 029 public FaceApiThriftDecorator(FaceApi delegate) { 030 super(); 031 if(null == delegate){ 032 throw new NullPointerException("delegate is null"); 033 } 034 this.delegate = delegate; 035 } 036 037 /** 038 * @return 返回被装饰的{@link FaceApi}实例 039 */ 040 public FaceApi delegate() { 041 return delegate; 042 } 043 /** 044 * @see net.gdface.sdk.FaceApi#compare2Face(byte[],net.gdface.sdk.CodeInfo,byte[],net.gdface.sdk.CodeInfo) 045 */ 046 @ThriftMethod(value = "compare2Face" ,exception = { 047 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 048 @ThriftException(type=NotFaceDetectedException.class, id=2), 049 @ThriftException(type=ServiceRuntimeException.class, id=3) 050 }) 051 public double compare2Face(ByteBuffer imgData1, 052 CodeInfo facePos1, 053 ByteBuffer imgData2, 054 CodeInfo facePos2) 055 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 056 try{ 057 return delegate().compare2Face(TypeTransformer.getInstance().to( 058 imgData1, 059 ByteBuffer.class, 060 byte[].class), 061 TypeTransformer.getInstance().to( 062 facePos1, 063 CodeInfo.class, 064 net.gdface.sdk.CodeInfo.class), 065 TypeTransformer.getInstance().to( 066 imgData2, 067 ByteBuffer.class, 068 byte[].class), 069 TypeTransformer.getInstance().to( 070 facePos2, 071 CodeInfo.class, 072 net.gdface.sdk.CodeInfo.class)); 073 } 074 catch(net.gdface.image.ImageErrorException e){ 075 throw new net.gdface.image.decorator.ImageErrorException(e); 076 } 077 catch(net.gdface.sdk.NotFaceDetectedException e){ 078 throw new NotFaceDetectedException(e); 079 } 080 catch(ServiceRuntimeException e){ 081 throw e; 082 } 083 catch(RuntimeException e){ 084 throw new ServiceRuntimeException(e); 085 } 086 } 087 /** 088 * @see net.gdface.sdk.FaceApi#compareCode(byte[],byte[]) 089 */ 090 @ThriftMethod(value = "compareCode" ) 091 public double compareCode(ByteBuffer code1, 092 ByteBuffer code2) 093 throws ServiceRuntimeException{ 094 try{ 095 return delegate().compareCode(TypeTransformer.getInstance().to( 096 code1, 097 ByteBuffer.class, 098 byte[].class), 099 TypeTransformer.getInstance().to( 100 code2, 101 ByteBuffer.class, 102 byte[].class)); 103 } 104 catch(ServiceRuntimeException e){ 105 throw e; 106 } 107 catch(RuntimeException e){ 108 throw new ServiceRuntimeException(e); 109 } 110 } 111 /** 112 * @see net.gdface.sdk.FaceApi#compareCodes(byte[],net.gdface.sdk.CodeInfo[]) 113 */ 114 @ThriftMethod(value = "compareCodes" ) 115 public java.util.List<Double> compareCodes(ByteBuffer code1, 116 java.util.List<CodeInfo> codes) 117 throws ServiceRuntimeException{ 118 try{ 119 return TypeTransformer.getInstance().to( 120 delegate().compareCodes(TypeTransformer.getInstance().to( 121 code1, 122 ByteBuffer.class, 123 byte[].class), 124 TypeTransformer.getInstance().toArray( 125 codes, 126 CodeInfo.class, 127 net.gdface.sdk.CodeInfo.class)), 128 double.class, 129 double.class); 130 } 131 catch(ServiceRuntimeException e){ 132 throw e; 133 } 134 catch(RuntimeException e){ 135 throw new ServiceRuntimeException(e); 136 } 137 } 138 /** 139 * @see net.gdface.sdk.FaceApi#compareFaces(byte[],byte[],int) 140 */ 141 @ThriftMethod(value = "compareFaces" ,exception = { 142 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 143 @ThriftException(type=NotFaceDetectedException.class, id=2), 144 @ThriftException(type=ServiceRuntimeException.class, id=3) 145 }) 146 public CompareResult compareFaces(ByteBuffer code, 147 ByteBuffer imgData, 148 int faceNum) 149 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 150 try{ 151 return TypeTransformer.getInstance().to( 152 delegate().compareFaces(TypeTransformer.getInstance().to( 153 code, 154 ByteBuffer.class, 155 byte[].class), 156 TypeTransformer.getInstance().to( 157 imgData, 158 ByteBuffer.class, 159 byte[].class), 160 faceNum), 161 net.gdface.sdk.CompareResult.class, 162 CompareResult.class); 163 } 164 catch(net.gdface.image.ImageErrorException e){ 165 throw new net.gdface.image.decorator.ImageErrorException(e); 166 } 167 catch(net.gdface.sdk.NotFaceDetectedException e){ 168 throw new NotFaceDetectedException(e); 169 } 170 catch(ServiceRuntimeException e){ 171 throw e; 172 } 173 catch(RuntimeException e){ 174 throw new ServiceRuntimeException(e); 175 } 176 } 177 /** 178 * @see net.gdface.sdk.FaceApi#compareFeatures(byte[],java.util.List) 179 */ 180 @ThriftMethod(value = "compareFeatures" ) 181 public List<Double> compareFeatures(ByteBuffer code1, 182 List<ByteBuffer> codes) 183 throws ServiceRuntimeException{ 184 try{ 185 return TypeTransformer.getInstance().to( 186 delegate().compareFeatures(TypeTransformer.getInstance().to( 187 code1, 188 ByteBuffer.class, 189 byte[].class), 190 TypeTransformer.getInstance().to( 191 codes, 192 ByteBuffer.class, 193 byte[].class)), 194 Double.class, 195 Double.class); 196 } 197 catch(ServiceRuntimeException e){ 198 throw e; 199 } 200 catch(RuntimeException e){ 201 throw new ServiceRuntimeException(e); 202 } 203 } 204 /** 205 * @see net.gdface.sdk.FaceApi#detectAndCompare2Face(byte[],net.gdface.sdk.FRect,byte[],net.gdface.sdk.FRect) 206 */ 207 @ThriftMethod(value = "detectAndCompare2Face" ,exception = { 208 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 209 @ThriftException(type=NotFaceDetectedException.class, id=2), 210 @ThriftException(type=ServiceRuntimeException.class, id=3) 211 }) 212 public double detectAndCompare2Face(ByteBuffer imgData1, 213 FRect detectRect1, 214 ByteBuffer imgData2, 215 FRect detectRect2) 216 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 217 try{ 218 return delegate().detectAndCompare2Face(TypeTransformer.getInstance().to( 219 imgData1, 220 ByteBuffer.class, 221 byte[].class), 222 TypeTransformer.getInstance().to( 223 detectRect1, 224 FRect.class, 225 net.gdface.sdk.FRect.class), 226 TypeTransformer.getInstance().to( 227 imgData2, 228 ByteBuffer.class, 229 byte[].class), 230 TypeTransformer.getInstance().to( 231 detectRect2, 232 FRect.class, 233 net.gdface.sdk.FRect.class)); 234 } 235 catch(net.gdface.image.ImageErrorException e){ 236 throw new net.gdface.image.decorator.ImageErrorException(e); 237 } 238 catch(net.gdface.sdk.NotFaceDetectedException e){ 239 throw new NotFaceDetectedException(e); 240 } 241 catch(ServiceRuntimeException e){ 242 throw e; 243 } 244 catch(RuntimeException e){ 245 throw new ServiceRuntimeException(e); 246 } 247 } 248 /** 249 * @see net.gdface.sdk.FaceApi#detectAndGetCodeInfo(byte[],int) 250 */ 251 @ThriftMethod(value = "detectAndGetCodeInfo" ,exception = { 252 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 253 @ThriftException(type=NotFaceDetectedException.class, id=2), 254 @ThriftException(type=ServiceRuntimeException.class, id=3) 255 }) 256 public java.util.List<CodeInfo> detectAndGetCodeInfo(ByteBuffer imgData, 257 int faceNum) 258 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 259 try{ 260 return TypeTransformer.getInstance().to( 261 delegate().detectAndGetCodeInfo(TypeTransformer.getInstance().to( 262 imgData, 263 ByteBuffer.class, 264 byte[].class), 265 faceNum), 266 net.gdface.sdk.CodeInfo.class, 267 CodeInfo.class); 268 } 269 catch(net.gdface.image.ImageErrorException e){ 270 throw new net.gdface.image.decorator.ImageErrorException(e); 271 } 272 catch(net.gdface.sdk.NotFaceDetectedException e){ 273 throw new NotFaceDetectedException(e); 274 } 275 catch(ServiceRuntimeException e){ 276 throw e; 277 } 278 catch(RuntimeException e){ 279 throw new ServiceRuntimeException(e); 280 } 281 } 282 /** 283 * @see net.gdface.sdk.FaceApi#detectCenterFace(byte[]) 284 */ 285 @ThriftMethod(value = "detectCenterFace" ,exception = { 286 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 287 @ThriftException(type=NotFaceDetectedException.class, id=2), 288 @ThriftException(type=ServiceRuntimeException.class, id=3) 289 }) 290 public CodeInfo detectCenterFace(ByteBuffer imgData) 291 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 292 try{ 293 return TypeTransformer.getInstance().to( 294 delegate().detectCenterFace(TypeTransformer.getInstance().to( 295 imgData, 296 ByteBuffer.class, 297 byte[].class)), 298 net.gdface.sdk.CodeInfo.class, 299 CodeInfo.class); 300 } 301 catch(net.gdface.image.ImageErrorException e){ 302 throw new net.gdface.image.decorator.ImageErrorException(e); 303 } 304 catch(net.gdface.sdk.NotFaceDetectedException e){ 305 throw new NotFaceDetectedException(e); 306 } 307 catch(ServiceRuntimeException e){ 308 throw e; 309 } 310 catch(RuntimeException e){ 311 throw new ServiceRuntimeException(e); 312 } 313 } 314 /** 315 * @see net.gdface.sdk.FaceApi#detectFace(byte[]) 316 */ 317 @ThriftMethod(value = "detectFace" ,exception = { 318 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 319 @ThriftException(type=ServiceRuntimeException.class, id=2) 320 }) 321 public java.util.List<CodeInfo> detectFace(ByteBuffer imgData) 322 throws net.gdface.image.decorator.ImageErrorException,ServiceRuntimeException{ 323 try{ 324 return TypeTransformer.getInstance().to( 325 delegate().detectFace(TypeTransformer.getInstance().to( 326 imgData, 327 ByteBuffer.class, 328 byte[].class)), 329 net.gdface.sdk.CodeInfo.class, 330 CodeInfo.class); 331 } 332 catch(net.gdface.image.ImageErrorException e){ 333 throw new net.gdface.image.decorator.ImageErrorException(e); 334 } 335 catch(ServiceRuntimeException e){ 336 throw e; 337 } 338 catch(RuntimeException e){ 339 throw new ServiceRuntimeException(e); 340 } 341 } 342 /** 343 * @see net.gdface.sdk.FaceApi#detectMaxFace(byte[]) 344 */ 345 @ThriftMethod(value = "detectMaxFace" ,exception = { 346 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 347 @ThriftException(type=NotFaceDetectedException.class, id=2), 348 @ThriftException(type=ServiceRuntimeException.class, id=3) 349 }) 350 public CodeInfo detectMaxFace(ByteBuffer imgData) 351 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 352 try{ 353 return TypeTransformer.getInstance().to( 354 delegate().detectMaxFace(TypeTransformer.getInstance().to( 355 imgData, 356 ByteBuffer.class, 357 byte[].class)), 358 net.gdface.sdk.CodeInfo.class, 359 CodeInfo.class); 360 } 361 catch(net.gdface.image.ImageErrorException e){ 362 throw new net.gdface.image.decorator.ImageErrorException(e); 363 } 364 catch(net.gdface.sdk.NotFaceDetectedException e){ 365 throw new NotFaceDetectedException(e); 366 } 367 catch(ServiceRuntimeException e){ 368 throw e; 369 } 370 catch(RuntimeException e){ 371 throw new ServiceRuntimeException(e); 372 } 373 } 374 /** 375 * @see net.gdface.sdk.FaceApi#getCodeInfo(byte[],int,net.gdface.sdk.CodeInfo[]) 376 */ 377 @ThriftMethod(value = "getCodeInfo" ,exception = { 378 @ThriftException(type=NotFaceDetectedException.class, id=1), 379 @ThriftException(type=ServiceRuntimeException.class, id=2) 380 }) 381 public java.util.List<CodeInfo> getCodeInfo(ByteBuffer imgData, 382 int faceNum, 383 java.util.List<CodeInfo> facePos) 384 throws NotFaceDetectedException,ServiceRuntimeException{ 385 try{ 386 return TypeTransformer.getInstance().to( 387 delegate().getCodeInfo(TypeTransformer.getInstance().to( 388 imgData, 389 ByteBuffer.class, 390 byte[].class), 391 faceNum, 392 TypeTransformer.getInstance().toArray( 393 facePos, 394 CodeInfo.class, 395 net.gdface.sdk.CodeInfo.class)), 396 net.gdface.sdk.CodeInfo.class, 397 CodeInfo.class); 398 } 399 catch(net.gdface.sdk.NotFaceDetectedException e){ 400 throw new NotFaceDetectedException(e); 401 } 402 catch(ServiceRuntimeException e){ 403 throw e; 404 } 405 catch(RuntimeException e){ 406 throw new ServiceRuntimeException(e); 407 } 408 } 409 /** 410 * @see net.gdface.sdk.FaceApi#getCodeInfo(byte[],net.gdface.sdk.CodeInfo) 411 */ 412 @ThriftMethod(value = "getCodeInfoSingle" ) 413 public CodeInfo getCodeInfoSingle(ByteBuffer imgData, 414 CodeInfo facePos) 415 throws ServiceRuntimeException{ 416 try{ 417 return TypeTransformer.getInstance().to( 418 delegate().getCodeInfo(TypeTransformer.getInstance().to( 419 imgData, 420 ByteBuffer.class, 421 byte[].class), 422 TypeTransformer.getInstance().to( 423 facePos, 424 CodeInfo.class, 425 net.gdface.sdk.CodeInfo.class)), 426 net.gdface.sdk.CodeInfo.class, 427 CodeInfo.class); 428 } 429 catch(ServiceRuntimeException e){ 430 throw e; 431 } 432 catch(RuntimeException e){ 433 throw new ServiceRuntimeException(e); 434 } 435 } 436 /** 437 * @see net.gdface.sdk.FaceApi#getFeature(java.util.Map) 438 */ 439 @ThriftMethod(value = "getFeature" ,exception = { 440 @ThriftException(type=NotFaceDetectedException.class, id=1), 441 @ThriftException(type=ServiceRuntimeException.class, id=2) 442 }) 443 public ByteBuffer getFeature(Map<ByteBuffer,CodeInfo> faces) 444 throws NotFaceDetectedException,ServiceRuntimeException{ 445 try{ 446 return TypeTransformer.getInstance().to( 447 delegate().getFeature(TypeTransformer.getInstance().to( 448 faces, 449 ByteBuffer.class, 450 CodeInfo.class, 451 ByteBuffer.class, 452 net.gdface.sdk.CodeInfo.class)), 453 byte[].class, 454 ByteBuffer.class); 455 } 456 catch(net.gdface.sdk.NotFaceDetectedException e){ 457 throw new NotFaceDetectedException(e); 458 } 459 catch(ServiceRuntimeException e){ 460 throw e; 461 } 462 catch(RuntimeException e){ 463 throw new ServiceRuntimeException(e); 464 } 465 } 466 /** 467 * @see net.gdface.sdk.FaceApi#hasFace(byte[]) 468 */ 469 @ThriftMethod(value = "hasFace" ,exception = { 470 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 471 @ThriftException(type=ServiceRuntimeException.class, id=2) 472 }) 473 public boolean hasFace(ByteBuffer imgData) 474 throws net.gdface.image.decorator.ImageErrorException,ServiceRuntimeException{ 475 try{ 476 return delegate().hasFace(TypeTransformer.getInstance().to( 477 imgData, 478 ByteBuffer.class, 479 byte[].class)); 480 } 481 catch(net.gdface.image.ImageErrorException e){ 482 throw new net.gdface.image.decorator.ImageErrorException(e); 483 } 484 catch(ServiceRuntimeException e){ 485 throw e; 486 } 487 catch(RuntimeException e){ 488 throw new ServiceRuntimeException(e); 489 } 490 } 491 /** 492 * @see net.gdface.sdk.FaceApi#isLocal() 493 */ 494 @ThriftMethod(value = "isLocal" ) 495 public boolean isLocal() 496 throws ServiceRuntimeException{ 497 try{ 498 return delegate().isLocal(); 499 } 500 catch(ServiceRuntimeException e){ 501 throw e; 502 } 503 catch(RuntimeException e){ 504 throw new ServiceRuntimeException(e); 505 } 506 } 507 /** 508 * @see net.gdface.sdk.FaceApi#matDetectAndGetCodeInfo(net.gdface.image.MatType,byte[],int,int,int) 509 */ 510 @ThriftMethod(value = "matDetectAndGetCodeInfo" ,exception = { 511 @ThriftException(type=NotFaceDetectedException.class, id=1), 512 @ThriftException(type=ServiceRuntimeException.class, id=2) 513 }) 514 public java.util.List<CodeInfo> matDetectAndGetCodeInfo(MatType matType, 515 ByteBuffer matData, 516 int width, 517 int height, 518 int faceNum) 519 throws NotFaceDetectedException,ServiceRuntimeException{ 520 try{ 521 return TypeTransformer.getInstance().to( 522 delegate().matDetectAndGetCodeInfo(TypeTransformer.getInstance().to( 523 matType, 524 MatType.class, 525 MatType.class), 526 TypeTransformer.getInstance().to( 527 matData, 528 ByteBuffer.class, 529 byte[].class), 530 width, 531 height, 532 faceNum), 533 net.gdface.sdk.CodeInfo.class, 534 CodeInfo.class); 535 } 536 catch(net.gdface.sdk.NotFaceDetectedException e){ 537 throw new NotFaceDetectedException(e); 538 } 539 catch(ServiceRuntimeException e){ 540 throw e; 541 } 542 catch(RuntimeException e){ 543 throw new ServiceRuntimeException(e); 544 } 545 } 546 /** 547 * @see net.gdface.sdk.FaceApi#matDetectFace(net.gdface.image.MatType,byte[],int,int) 548 */ 549 @ThriftMethod(value = "matDetectFace" ) 550 public java.util.List<CodeInfo> matDetectFace(MatType matType, 551 ByteBuffer matData, 552 int width, 553 int height) 554 throws ServiceRuntimeException{ 555 try{ 556 return TypeTransformer.getInstance().to( 557 delegate().matDetectFace(TypeTransformer.getInstance().to( 558 matType, 559 MatType.class, 560 MatType.class), 561 TypeTransformer.getInstance().to( 562 matData, 563 ByteBuffer.class, 564 byte[].class), 565 width, 566 height), 567 net.gdface.sdk.CodeInfo.class, 568 CodeInfo.class); 569 } 570 catch(ServiceRuntimeException e){ 571 throw e; 572 } 573 catch(RuntimeException e){ 574 throw new ServiceRuntimeException(e); 575 } 576 } 577 /** 578 * @see net.gdface.sdk.FaceApi#matDetectMaxFace(net.gdface.image.MatType,byte[],int,int) 579 */ 580 @ThriftMethod(value = "matDetectMaxFace" ,exception = { 581 @ThriftException(type=NotFaceDetectedException.class, id=1), 582 @ThriftException(type=ServiceRuntimeException.class, id=2) 583 }) 584 public CodeInfo matDetectMaxFace(MatType matType, 585 ByteBuffer matData, 586 int width, 587 int height) 588 throws NotFaceDetectedException,ServiceRuntimeException{ 589 try{ 590 return TypeTransformer.getInstance().to( 591 delegate().matDetectMaxFace(TypeTransformer.getInstance().to( 592 matType, 593 MatType.class, 594 MatType.class), 595 TypeTransformer.getInstance().to( 596 matData, 597 ByteBuffer.class, 598 byte[].class), 599 width, 600 height), 601 net.gdface.sdk.CodeInfo.class, 602 CodeInfo.class); 603 } 604 catch(net.gdface.sdk.NotFaceDetectedException e){ 605 throw new NotFaceDetectedException(e); 606 } 607 catch(ServiceRuntimeException e){ 608 throw e; 609 } 610 catch(RuntimeException e){ 611 throw new ServiceRuntimeException(e); 612 } 613 } 614 /** 615 * @see net.gdface.sdk.FaceApi#matGetCodeInfo(net.gdface.image.MatType,byte[],int,int,int,net.gdface.sdk.CodeInfo[]) 616 */ 617 @ThriftMethod(value = "matGetCodeInfo" ,exception = { 618 @ThriftException(type=NotFaceDetectedException.class, id=1), 619 @ThriftException(type=ServiceRuntimeException.class, id=2) 620 }) 621 public java.util.List<CodeInfo> matGetCodeInfo(MatType matType, 622 ByteBuffer matData, 623 int width, 624 int height, 625 int facenum, 626 java.util.List<CodeInfo> facePos) 627 throws NotFaceDetectedException,ServiceRuntimeException{ 628 try{ 629 return TypeTransformer.getInstance().to( 630 delegate().matGetCodeInfo(TypeTransformer.getInstance().to( 631 matType, 632 MatType.class, 633 MatType.class), 634 TypeTransformer.getInstance().to( 635 matData, 636 ByteBuffer.class, 637 byte[].class), 638 width, 639 height, 640 facenum, 641 TypeTransformer.getInstance().toArray( 642 facePos, 643 CodeInfo.class, 644 net.gdface.sdk.CodeInfo.class)), 645 net.gdface.sdk.CodeInfo.class, 646 CodeInfo.class); 647 } 648 catch(net.gdface.sdk.NotFaceDetectedException e){ 649 throw new NotFaceDetectedException(e); 650 } 651 catch(ServiceRuntimeException e){ 652 throw e; 653 } 654 catch(RuntimeException e){ 655 throw new ServiceRuntimeException(e); 656 } 657 } 658 /** 659 * @see net.gdface.sdk.FaceApi#matGetCodeInfo(net.gdface.image.MatType,byte[],int,int,net.gdface.sdk.CodeInfo) 660 */ 661 @ThriftMethod(value = "matGetCodeInfoSingle" ) 662 public CodeInfo matGetCodeInfoSingle(MatType matType, 663 ByteBuffer matData, 664 int width, 665 int height, 666 CodeInfo facePos) 667 throws ServiceRuntimeException{ 668 try{ 669 return TypeTransformer.getInstance().to( 670 delegate().matGetCodeInfo(TypeTransformer.getInstance().to( 671 matType, 672 MatType.class, 673 MatType.class), 674 TypeTransformer.getInstance().to( 675 matData, 676 ByteBuffer.class, 677 byte[].class), 678 width, 679 height, 680 TypeTransformer.getInstance().to( 681 facePos, 682 CodeInfo.class, 683 net.gdface.sdk.CodeInfo.class)), 684 net.gdface.sdk.CodeInfo.class, 685 CodeInfo.class); 686 } 687 catch(ServiceRuntimeException e){ 688 throw e; 689 } 690 catch(RuntimeException e){ 691 throw new ServiceRuntimeException(e); 692 } 693 } 694 /** 695 * @see net.gdface.sdk.FaceApi#matHasFace(net.gdface.image.MatType,byte[],int,int) 696 */ 697 @ThriftMethod(value = "matHasFace" ) 698 public boolean matHasFace(MatType matType, 699 ByteBuffer matData, 700 int width, 701 int height) 702 throws ServiceRuntimeException{ 703 try{ 704 return delegate().matHasFace(TypeTransformer.getInstance().to( 705 matType, 706 MatType.class, 707 MatType.class), 708 TypeTransformer.getInstance().to( 709 matData, 710 ByteBuffer.class, 711 byte[].class), 712 width, 713 height); 714 } 715 catch(ServiceRuntimeException e){ 716 throw e; 717 } 718 catch(RuntimeException e){ 719 throw new ServiceRuntimeException(e); 720 } 721 } 722 /** 723 * @see net.gdface.sdk.FaceApi#matSearchFaces(net.gdface.image.MatType,byte[],int,int,net.gdface.sdk.CodeInfo,double,int) 724 */ 725 @ThriftMethod(value = "matSearchFaces" ,exception = { 726 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 727 @ThriftException(type=NotFaceDetectedException.class, id=2), 728 @ThriftException(type=ServiceRuntimeException.class, id=3) 729 }) 730 public java.util.List<FseResult> matSearchFaces(MatType matType, 731 ByteBuffer matData, 732 int width, 733 int height, 734 CodeInfo facePos, 735 double similarty, 736 int rows) 737 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 738 try{ 739 return TypeTransformer.getInstance().to( 740 delegate().matSearchFaces(TypeTransformer.getInstance().to( 741 matType, 742 MatType.class, 743 MatType.class), 744 TypeTransformer.getInstance().to( 745 matData, 746 ByteBuffer.class, 747 byte[].class), 748 width, 749 height, 750 TypeTransformer.getInstance().to( 751 facePos, 752 CodeInfo.class, 753 net.gdface.sdk.CodeInfo.class), 754 similarty, 755 rows), 756 net.gdface.sdk.FseResult.class, 757 FseResult.class); 758 } 759 catch(net.gdface.image.ImageErrorException e){ 760 throw new net.gdface.image.decorator.ImageErrorException(e); 761 } 762 catch(net.gdface.sdk.NotFaceDetectedException e){ 763 throw new NotFaceDetectedException(e); 764 } 765 catch(ServiceRuntimeException e){ 766 throw e; 767 } 768 catch(RuntimeException e){ 769 throw new ServiceRuntimeException(e); 770 } 771 } 772 /** 773 * @see net.gdface.sdk.FaceApi#matWearMask(net.gdface.image.MatType,byte[],int,int,net.gdface.sdk.CodeInfo) 774 */ 775 @ThriftMethod(value = "matWearMask" ) 776 public Boolean matWearMask(MatType matType, 777 ByteBuffer matData, 778 int width, 779 int height, 780 CodeInfo faceInfo) 781 throws ServiceRuntimeException{ 782 try{ 783 return delegate().matWearMask(TypeTransformer.getInstance().to( 784 matType, 785 MatType.class, 786 MatType.class), 787 TypeTransformer.getInstance().to( 788 matData, 789 ByteBuffer.class, 790 byte[].class), 791 width, 792 height, 793 TypeTransformer.getInstance().to( 794 faceInfo, 795 CodeInfo.class, 796 net.gdface.sdk.CodeInfo.class)); 797 } 798 catch(ServiceRuntimeException e){ 799 throw e; 800 } 801 catch(RuntimeException e){ 802 throw new ServiceRuntimeException(e); 803 } 804 } 805 /** 806 * @see net.gdface.sdk.FaceApi#sdkCapacity() 807 */ 808 @ThriftMethod(value = "sdkCapacity" ) 809 public Map<String,String> sdkCapacity() 810 throws ServiceRuntimeException{ 811 try{ 812 return TypeTransformer.getInstance().to( 813 delegate().sdkCapacity(), 814 String.class, 815 String.class, 816 String.class, 817 String.class); 818 } 819 catch(ServiceRuntimeException e){ 820 throw e; 821 } 822 catch(RuntimeException e){ 823 throw new ServiceRuntimeException(e); 824 } 825 } 826 /** 827 * @see net.gdface.sdk.FaceApi#searchFaces(byte[],net.gdface.sdk.CodeInfo,double,int) 828 */ 829 @ThriftMethod(value = "searchFaces" ,exception = { 830 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 831 @ThriftException(type=NotFaceDetectedException.class, id=2), 832 @ThriftException(type=ServiceRuntimeException.class, id=3) 833 }) 834 public java.util.List<FseResult> searchFaces(ByteBuffer imgData, 835 CodeInfo facePos, 836 double similarty, 837 int rows) 838 throws net.gdface.image.decorator.ImageErrorException,NotFaceDetectedException,ServiceRuntimeException{ 839 try{ 840 return TypeTransformer.getInstance().to( 841 delegate().searchFaces(TypeTransformer.getInstance().to( 842 imgData, 843 ByteBuffer.class, 844 byte[].class), 845 TypeTransformer.getInstance().to( 846 facePos, 847 CodeInfo.class, 848 net.gdface.sdk.CodeInfo.class), 849 similarty, 850 rows), 851 net.gdface.sdk.FseResult.class, 852 FseResult.class); 853 } 854 catch(net.gdface.image.ImageErrorException e){ 855 throw new net.gdface.image.decorator.ImageErrorException(e); 856 } 857 catch(net.gdface.sdk.NotFaceDetectedException e){ 858 throw new NotFaceDetectedException(e); 859 } 860 catch(ServiceRuntimeException e){ 861 throw e; 862 } 863 catch(RuntimeException e){ 864 throw new ServiceRuntimeException(e); 865 } 866 } 867 /** 868 * @see net.gdface.sdk.FaceApi#searchFeatures(byte[],double,int) 869 */ 870 @ThriftMethod(value = "searchFeatures" ) 871 public java.util.List<FseResult> searchFeatures(ByteBuffer feature, 872 double similarty, 873 int rows) 874 throws ServiceRuntimeException{ 875 try{ 876 return TypeTransformer.getInstance().to( 877 delegate().searchFeatures(TypeTransformer.getInstance().to( 878 feature, 879 ByteBuffer.class, 880 byte[].class), 881 similarty, 882 rows), 883 net.gdface.sdk.FseResult.class, 884 FseResult.class); 885 } 886 catch(ServiceRuntimeException e){ 887 throw e; 888 } 889 catch(RuntimeException e){ 890 throw new ServiceRuntimeException(e); 891 } 892 } 893 /** 894 * @see net.gdface.sdk.FaceApi#wearMask(byte[],net.gdface.sdk.CodeInfo) 895 */ 896 @ThriftMethod(value = "wearMask" ,exception = { 897 @ThriftException(type=net.gdface.image.decorator.ImageErrorException.class, id=1), 898 @ThriftException(type=ServiceRuntimeException.class, id=2) 899 }) 900 public Boolean wearMask(ByteBuffer imgData, 901 CodeInfo faceInfo) 902 throws net.gdface.image.decorator.ImageErrorException,ServiceRuntimeException{ 903 try{ 904 return delegate().wearMask(TypeTransformer.getInstance().to( 905 imgData, 906 ByteBuffer.class, 907 byte[].class), 908 TypeTransformer.getInstance().to( 909 faceInfo, 910 CodeInfo.class, 911 net.gdface.sdk.CodeInfo.class)); 912 } 913 catch(net.gdface.image.ImageErrorException e){ 914 throw new net.gdface.image.decorator.ImageErrorException(e); 915 } 916 catch(ServiceRuntimeException e){ 917 throw e; 918 } 919 catch(RuntimeException e){ 920 throw new ServiceRuntimeException(e); 921 } 922 } 923}