All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.facedb.thrift.FaceDbThriftClientAsync Maven / Gradle / Ivy

// ______________________________________________________
// Generated by codegen - https://gitee.com/l0km/codegen 
// template: thrift/client_thrifty/perservice/client.async.decorator.class.vm
// ______________________________________________________
package net.gdface.facedb.thrift;
import java.nio.ByteBuffer;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.gdface.facedb.FaceDb;
import net.gdface.facedb.SearchResult;
import net.gdface.facedb.db.FaceBean;
import net.gdface.facedb.db.FeatureBean;
import net.gdface.facedb.db.ImageBean;
import net.gdface.sdk.CodeInfo;
import net.gdface.sdk.FRect;
import net.gdface.thrift.TypeTransformer;

import java.io.IOException;
import com.google.common.base.Function;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.microsoft.thrifty.ThriftException;
import com.microsoft.thrifty.service.AsyncClientBase;
import com.microsoft.thrifty.service.ServiceMethodCallback;

import net.gdface.thrift.ClientFactory;
import static com.google.common.base.Preconditions.*;

/**
 * 基于thrift/swift框架生成的client端代码提供{@link FaceDb}接口的异步RPC实现(线程安全)
* 转发所有{@link FaceDb}接口方法到{@link net.gdface.facedb.thrift.client.FaceDbClient}实例
* 所有服务端抛出的{@link RuntimeException}异常被封装到{@link ServiceRuntimeException}中抛出
* Example:
*
 *        FaceDbThriftClientAsync thriftInstance = ClientFactory
 *            .builder()
 *            .setHostAndPort("127.0.0.1",26413)
 *            .build(FaceDbThriftClientAsync.class);
 * 
* 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)
* @author guyadong * */ public class FaceDbThriftClientAsync { private final ClientFactory factory; public ClientFactory getFactory() { return factory; } public FaceDbThriftClientAsync(ClientFactory factory) { super(); this.factory = checkNotNull(factory,"factory is null"); } private class MethodCallback implements ServiceMethodCallback{ private final AsyncClientBase.Listener closeListener = new AsyncClientBase.Listener(){ @Override public void onTransportClosed() { } @Override public void onError(Throwable error) { MethodCallback.this.onError(error); } }; final net.gdface.facedb.thrift.client.FaceDbClient service = factory.applyInstance(net.gdface.facedb.thrift.client.FaceDbClient.class,closeListener); final SettableFuture feature = SettableFuture.create(); final Function transformer; MethodCallback(Function transformer) { this.transformer = transformer; } @Override public void onSuccess(R result) { feature.set(transformer.apply(result)); try { service.close(); } catch (IOException e) { } } @Override public void onError(Throwable error) { if(error instanceof ThriftException ){ if(((ThriftException)error).kind == ThriftException.Kind.MISSING_RESULT ){ this.onSuccess(null); } } feature.setException(error); try { service.close(); } catch (IOException e) { } } } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("FaceDbThriftClientAsync [factory="); builder.append(factory); builder.append(",interface="); builder.append(FaceDb.class.getName()); builder.append("]"); return builder.toString(); } /** * 默认的{@link FutureCallback}实现 * @author guyadong * * @param */ public static class DefaultCallback implements FutureCallback{ @Override public void onSuccess(V result) { // DO NOTHING } @Override public void onFailure(Throwable t) { try{ throw t; } catch(net.gdface.facedb.thrift.client.NotFoundBeanException e){ onNotFoundBeanException(e); } catch(net.gdface.facedb.thrift.client.DuplicateRecordException e){ onDuplicateRecordException(e); } catch(net.gdface.facedb.thrift.client.ImageErrorException e){ onImageErrorException(e); } catch(net.gdface.facedb.thrift.client.NotFaceDetectedException e){ onNotFaceDetectedException(e); } catch(net.gdface.facedb.thrift.client.ServiceRuntimeException e){ onServiceRuntimeException(e); } catch(Throwable e){ onThrowable(e); } } protected void onNotFoundBeanException(net.gdface.facedb.thrift.client.NotFoundBeanException e){ System.out.println(e.serviceStackTraceMessage); } protected void onDuplicateRecordException(net.gdface.facedb.thrift.client.DuplicateRecordException e){ System.out.println(e.serviceStackTraceMessage); } protected void onImageErrorException(net.gdface.facedb.thrift.client.ImageErrorException e){ System.out.println(e.serviceStackTraceMessage); } protected void onNotFaceDetectedException(net.gdface.facedb.thrift.client.NotFaceDetectedException e){ System.out.println(e.serviceStackTraceMessage); } protected void onServiceRuntimeException(net.gdface.facedb.thrift.client.ServiceRuntimeException e){ System.out.println(e.serviceStackTraceMessage); } protected void onThrowable(Throwable e){ e.printStackTrace(); } } /** * see also {@link net.gdface.facedb.FaceDb#addFeature(byte[],java.util.Map)} */ public ListenableFuture addFeature(byte[] feature, Map faces){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FeatureBean apply(net.gdface.facedb.thrift.client.FeatureBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FeatureBean.class, FeatureBean.class); }}); nativeCallback.service.addFeature( TypeTransformer.getInstance().to( feature, byte[].class, okio.ByteString.class), TypeTransformer.getInstance().to( faces, ByteBuffer.class, CodeInfo.class, okio.ByteString.class, net.gdface.facedb.thrift.client.CodeInfo.class),nativeCallback); return nativeCallback.feature; } public void addFeature(byte[] feature, Map faces, FutureCallbackcallback){ factory.addCallback(addFeature(feature,faces), callback); } /** * see also {@link net.gdface.facedb.FaceDb#addImage(byte[],java.util.List)} */ public ListenableFuture addImage(byte[] imgData, List features){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public ImageBean apply(net.gdface.facedb.thrift.client.ImageBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.addImage( TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), TypeTransformer.getInstance().to( features, CodeInfo.class, net.gdface.facedb.thrift.client.CodeInfo.class),nativeCallback); return nativeCallback.feature; } public void addImage(byte[] imgData, List features, FutureCallbackcallback){ factory.addCallback(addImage(imgData,features), callback); } /** * see also {@link net.gdface.facedb.FaceDb#addImageIfAbsent(byte[],net.gdface.sdk.CodeInfo,double)} */ public ListenableFuture addImageIfAbsent(byte[] imgData, CodeInfo code, double similarty){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public ImageBean apply(net.gdface.facedb.thrift.client.ImageBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.addImageIfAbsent( TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), TypeTransformer.getInstance().to( code, CodeInfo.class, net.gdface.facedb.thrift.client.CodeInfo.class), similarty,nativeCallback); return nativeCallback.feature; } public void addImageIfAbsent(byte[] imgData, CodeInfo code, double similarty, FutureCallbackcallback){ factory.addCallback(addImageIfAbsent(imgData,code,similarty), callback); } /** * see also {@link net.gdface.facedb.FaceDb#compareFaces(java.lang.String,byte[],net.gdface.sdk.CodeInfo[])} */ public ListenableFuture compareFaces(String featureId, byte[] imgData, CodeInfo[] facePos){ MethodCallback> nativeCallback = new MethodCallback>( new Function,double[]>() { @Override public double[] apply(java.util.List input) { return TypeTransformer.getInstance().todoubleArray( input, double.class, double.class); }}); nativeCallback.service.compareFaces( featureId, TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), TypeTransformer.getInstance().to( facePos, CodeInfo.class, net.gdface.facedb.thrift.client.CodeInfo.class),nativeCallback); return nativeCallback.feature; } public void compareFaces(String featureId, byte[] imgData, CodeInfo[] facePos, FutureCallbackcallback){ factory.addCallback(compareFaces(featureId,imgData,facePos), callback); } /** * see also {@link net.gdface.facedb.FaceDb#compareFeature(java.lang.String,byte[])} */ public ListenableFuture compareFeature(String featureId, byte[] feature){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Double apply(Double input) { return input; }}); nativeCallback.service.compareFeature( featureId, TypeTransformer.getInstance().to( feature, byte[].class, okio.ByteString.class),nativeCallback); return nativeCallback.feature; } public void compareFeature(String featureId, byte[] feature, FutureCallbackcallback){ factory.addCallback(compareFeature(featureId,feature), callback); } /** * see also {@link net.gdface.facedb.FaceDb#compareFeature(java.lang.String,java.lang.String)} */ public ListenableFuture compareFeature(String featureId1, String featureId2){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Double apply(Double input) { return input; }}); nativeCallback.service.compareFeatureByFeatureId( featureId1, featureId2,nativeCallback); return nativeCallback.feature; } public void compareFeature(String featureId1, String featureId2, FutureCallbackcallback){ factory.addCallback(compareFeature(featureId1,featureId2), callback); } /** * see also {@link net.gdface.facedb.FaceDb#compareFeatures(java.lang.String,net.gdface.sdk.CodeInfo[])} */ public ListenableFuture compareFeatures(String featureId, CodeInfo[] features){ MethodCallback> nativeCallback = new MethodCallback>( new Function,double[]>() { @Override public double[] apply(java.util.List input) { return TypeTransformer.getInstance().todoubleArray( input, double.class, double.class); }}); nativeCallback.service.compareFeatures( featureId, TypeTransformer.getInstance().to( features, CodeInfo.class, net.gdface.facedb.thrift.client.CodeInfo.class),nativeCallback); return nativeCallback.feature; } public void compareFeatures(String featureId, CodeInfo[] features, FutureCallbackcallback){ factory.addCallback(compareFeatures(featureId,features), callback); } /** * see also {@link net.gdface.facedb.FaceDb#deleteFeature(java.lang.String,boolean)} */ public ListenableFuture deleteFeature(String featureId, boolean cascade){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Boolean apply(Boolean input) { return input; }}); nativeCallback.service.deleteFeature( featureId, cascade,nativeCallback); return nativeCallback.feature; } public void deleteFeature(String featureId, boolean cascade, FutureCallbackcallback){ factory.addCallback(deleteFeature(featureId,cascade), callback); } /** * see also {@link net.gdface.facedb.FaceDb#deleteFeatures(java.util.List,boolean)} */ public ListenableFuture deleteFeatures(List featureIdList, boolean cascade){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Integer apply(Integer input) { return input; }}); nativeCallback.service.deleteFeatures( TypeTransformer.getInstance().to( featureIdList, String.class, String.class), cascade,nativeCallback); return nativeCallback.feature; } public void deleteFeatures(List featureIdList, boolean cascade, FutureCallbackcallback){ factory.addCallback(deleteFeatures(featureIdList,cascade), callback); } /** * see also {@link net.gdface.facedb.FaceDb#deleteImage(java.lang.String,boolean)} */ public ListenableFuture deleteImage(String imgMd5, boolean cascade){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Boolean apply(Boolean input) { return input; }}); nativeCallback.service.deleteImage( imgMd5, cascade,nativeCallback); return nativeCallback.feature; } public void deleteImage(String imgMd5, boolean cascade, FutureCallbackcallback){ factory.addCallback(deleteImage(imgMd5,cascade), callback); } /** * see also {@link net.gdface.facedb.FaceDb#deleteImages(java.util.List,boolean)} */ public ListenableFuture deleteImages(List imgMd5List, boolean cascade){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Integer apply(Integer input) { return input; }}); nativeCallback.service.deleteImages( TypeTransformer.getInstance().to( imgMd5List, String.class, String.class), cascade,nativeCallback); return nativeCallback.feature; } public void deleteImages(List imgMd5List, boolean cascade, FutureCallbackcallback){ factory.addCallback(deleteImages(imgMd5List,cascade), callback); } /** * see also {@link net.gdface.facedb.FaceDb#detectAndAddFeatures(byte[],int,net.gdface.sdk.FRect)} */ public ListenableFuture detectAndAddFeatures(byte[] imgData, int faceNum, FRect detectRectangle){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public ImageBean apply(net.gdface.facedb.thrift.client.ImageBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.detectAndAddFeatures( TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), faceNum, TypeTransformer.getInstance().to( detectRectangle, FRect.class, net.gdface.facedb.thrift.client.FRect.class),nativeCallback); return nativeCallback.feature; } public void detectAndAddFeatures(byte[] imgData, int faceNum, FRect detectRectangle, FutureCallbackcallback){ factory.addCallback(detectAndAddFeatures(imgData,faceNum,detectRectangle), callback); } /** * see also {@link net.gdface.facedb.FaceDb#detectAndCompareFaces(java.lang.String,byte[],int,net.gdface.sdk.FRect)} */ public ListenableFuture> detectAndCompareFaces(String featureId, byte[] imgData, int faceNum, FRect detectRectangle){ MethodCallback,Map> nativeCallback = new MethodCallback,Map>( new Function,Map>() { @Override public Map apply(Map input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.CodeInfo.class, Double.class, CodeInfo.class, Double.class); }}); nativeCallback.service.detectAndCompareFaces( featureId, TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), faceNum, TypeTransformer.getInstance().to( detectRectangle, FRect.class, net.gdface.facedb.thrift.client.FRect.class),nativeCallback); return nativeCallback.feature; } public void detectAndCompareFaces(String featureId, byte[] imgData, int faceNum, FRect detectRectangle, FutureCallback>callback){ factory.addCallback(detectAndCompareFaces(featureId,imgData,faceNum,detectRectangle), callback); } /** * see also {@link net.gdface.facedb.FaceDb#detectAndSearchFaces(byte[],net.gdface.sdk.FRect,double,int,java.lang.String)} */ public ListenableFuture detectAndSearchFaces(byte[] imgData, FRect detectRectangle, double similarty, int rows, String where){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public SearchResult apply(net.gdface.facedb.thrift.client.SearchResult input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.SearchResult.class, SearchResult.class); }}); nativeCallback.service.detectAndSearchFaces( TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), TypeTransformer.getInstance().to( detectRectangle, FRect.class, net.gdface.facedb.thrift.client.FRect.class), similarty, rows, where,nativeCallback); return nativeCallback.feature; } public void detectAndSearchFaces(byte[] imgData, FRect detectRectangle, double similarty, int rows, String where, FutureCallbackcallback){ factory.addCallback(detectAndSearchFaces(imgData,detectRectangle,similarty,rows,where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getCodeInfo(int)} */ public ListenableFuture getCodeInfo(int faceId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public CodeInfo apply(net.gdface.facedb.thrift.client.CodeInfo input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.CodeInfo.class, CodeInfo.class); }}); nativeCallback.service.getCodeInfo( faceId,nativeCallback); return nativeCallback.feature; } public void getCodeInfo(int faceId, FutureCallbackcallback){ factory.addCallback(getCodeInfo(faceId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getCodeInfoByFeatureId(java.lang.String)} */ public ListenableFuture getCodeInfoByFeatureId(String featureId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public CodeInfo apply(net.gdface.facedb.thrift.client.CodeInfo input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.CodeInfo.class, CodeInfo.class); }}); nativeCallback.service.getCodeInfoByFeatureId( featureId,nativeCallback); return nativeCallback.feature; } public void getCodeInfoByFeatureId(String featureId, FutureCallbackcallback){ factory.addCallback(getCodeInfoByFeatureId(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getCodeInfoByImageMd5(java.lang.String)} */ public ListenableFuture getCodeInfoByImageMd5(String imageMd5){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public CodeInfo apply(net.gdface.facedb.thrift.client.CodeInfo input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.CodeInfo.class, CodeInfo.class); }}); nativeCallback.service.getCodeInfoByImageMd5( imageMd5,nativeCallback); return nativeCallback.feature; } public void getCodeInfoByImageMd5(String imageMd5, FutureCallbackcallback){ factory.addCallback(getCodeInfoByImageMd5(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getCodeInfosByFeatureId(java.lang.String)} */ public ListenableFuture> getCodeInfosByFeatureId(String featureId){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.CodeInfo.class, CodeInfo.class); }}); nativeCallback.service.getCodeInfosByFeatureId( featureId,nativeCallback); return nativeCallback.feature; } public void getCodeInfosByFeatureId(String featureId, FutureCallback>callback){ factory.addCallback(getCodeInfosByFeatureId(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getCodeInfosByImageMd5(java.lang.String)} */ public ListenableFuture> getCodeInfosByImageMd5(String imageMd5){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.CodeInfo.class, CodeInfo.class); }}); nativeCallback.service.getCodeInfosByImageMd5( imageMd5,nativeCallback); return nativeCallback.feature; } public void getCodeInfosByImageMd5(String imageMd5, FutureCallback>callback){ factory.addCallback(getCodeInfosByImageMd5(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFace(int)} */ public ListenableFuture getFace(int faceId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FaceBean apply(net.gdface.facedb.thrift.client.FaceBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FaceBean.class, FaceBean.class); }}); nativeCallback.service.getFace( faceId,nativeCallback); return nativeCallback.feature; } public void getFace(int faceId, FutureCallbackcallback){ factory.addCallback(getFace(faceId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFaceByFeatureId(java.lang.String)} */ public ListenableFuture getFaceByFeatureId(String featureId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FaceBean apply(net.gdface.facedb.thrift.client.FaceBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FaceBean.class, FaceBean.class); }}); nativeCallback.service.getFaceByFeatureId( featureId,nativeCallback); return nativeCallback.feature; } public void getFaceByFeatureId(String featureId, FutureCallbackcallback){ factory.addCallback(getFaceByFeatureId(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFaceByImageMd5(java.lang.String)} */ public ListenableFuture getFaceByImageMd5(String imageMd5){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FaceBean apply(net.gdface.facedb.thrift.client.FaceBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FaceBean.class, FaceBean.class); }}); nativeCallback.service.getFaceByImageMd5( imageMd5,nativeCallback); return nativeCallback.feature; } public void getFaceByImageMd5(String imageMd5, FutureCallbackcallback){ factory.addCallback(getFaceByImageMd5(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFaceCount(java.lang.String)} */ public ListenableFuture getFaceCount(String where){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Integer apply(Integer input) { return input; }}); nativeCallback.service.getFaceCount( where,nativeCallback); return nativeCallback.feature; } public void getFaceCount(String where, FutureCallbackcallback){ factory.addCallback(getFaceCount(where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFacesByFeatureId(java.lang.String)} */ public ListenableFuture> getFacesByFeatureId(String featureId){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FaceBean.class, FaceBean.class); }}); nativeCallback.service.getFacesByFeatureId( featureId,nativeCallback); return nativeCallback.feature; } public void getFacesByFeatureId(String featureId, FutureCallback>callback){ factory.addCallback(getFacesByFeatureId(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFacesByImageMd5(java.lang.String)} */ public ListenableFuture> getFacesByImageMd5(String imageMd5){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FaceBean.class, FaceBean.class); }}); nativeCallback.service.getFacesByImageMd5( imageMd5,nativeCallback); return nativeCallback.feature; } public void getFacesByImageMd5(String imageMd5, FutureCallback>callback){ factory.addCallback(getFacesByImageMd5(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFeature(java.lang.String)} */ public ListenableFuture getFeature(String featureId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FeatureBean apply(net.gdface.facedb.thrift.client.FeatureBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FeatureBean.class, FeatureBean.class); }}); nativeCallback.service.getFeature( featureId,nativeCallback); return nativeCallback.feature; } public void getFeature(String featureId, FutureCallbackcallback){ factory.addCallback(getFeature(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFeatureByFaceId(int)} */ public ListenableFuture getFeatureByFaceId(int faceId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FeatureBean apply(net.gdface.facedb.thrift.client.FeatureBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FeatureBean.class, FeatureBean.class); }}); nativeCallback.service.getFeatureByFaceId( faceId,nativeCallback); return nativeCallback.feature; } public void getFeatureByFaceId(int faceId, FutureCallbackcallback){ factory.addCallback(getFeatureByFaceId(faceId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFeatureByImageMd5(java.lang.String)} */ public ListenableFuture getFeatureByImageMd5(String imageMd5){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public FeatureBean apply(net.gdface.facedb.thrift.client.FeatureBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FeatureBean.class, FeatureBean.class); }}); nativeCallback.service.getFeatureByImageMd5( imageMd5,nativeCallback); return nativeCallback.feature; } public void getFeatureByImageMd5(String imageMd5, FutureCallbackcallback){ factory.addCallback(getFeatureByImageMd5(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFeatureCount()} */ public ListenableFuture getFeatureCount(){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Integer apply(Integer input) { return input; }}); nativeCallback.service.getFeatureCount( nativeCallback); return nativeCallback.feature; } public void getFeatureCount(FutureCallbackcallback){ factory.addCallback(getFeatureCount(), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getFeaturesByImageMd5(java.lang.String)} */ public ListenableFuture> getFeaturesByImageMd5(String imageMd5){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.FeatureBean.class, FeatureBean.class); }}); nativeCallback.service.getFeaturesByImageMd5( imageMd5,nativeCallback); return nativeCallback.feature; } public void getFeaturesByImageMd5(String imageMd5, FutureCallback>callback){ factory.addCallback(getFeaturesByImageMd5(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getImage(java.lang.String)} */ public ListenableFuture getImage(String imageMd5){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public ImageBean apply(net.gdface.facedb.thrift.client.ImageBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.getImage( imageMd5,nativeCallback); return nativeCallback.feature; } public void getImage(String imageMd5, FutureCallbackcallback){ factory.addCallback(getImage(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getImageByFaceId(int)} */ public ListenableFuture getImageByFaceId(int faceId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public ImageBean apply(net.gdface.facedb.thrift.client.ImageBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.getImageByFaceId( faceId,nativeCallback); return nativeCallback.feature; } public void getImageByFaceId(int faceId, FutureCallbackcallback){ factory.addCallback(getImageByFaceId(faceId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getImageByFeatureId(java.lang.String)} */ public ListenableFuture getImageByFeatureId(String featureId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public ImageBean apply(net.gdface.facedb.thrift.client.ImageBean input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.getImageByFeatureId( featureId,nativeCallback); return nativeCallback.feature; } public void getImageByFeatureId(String featureId, FutureCallbackcallback){ factory.addCallback(getImageByFeatureId(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getImageBytes(java.lang.String)} */ public ListenableFuture getImageBytes(String imageMd5){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public byte[] apply(okio.ByteString input) { return TypeTransformer.getInstance().to( input, okio.ByteString.class, byte[].class); }}); nativeCallback.service.getImageBytes( imageMd5,nativeCallback); return nativeCallback.feature; } public void getImageBytes(String imageMd5, FutureCallbackcallback){ factory.addCallback(getImageBytes(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getImageCount(java.lang.String)} */ public ListenableFuture getImageCount(String where){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Integer apply(Integer input) { return input; }}); nativeCallback.service.getImageCount( where,nativeCallback); return nativeCallback.feature; } public void getImageCount(String where, FutureCallbackcallback){ factory.addCallback(getImageCount(where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#getImagesByFeatureId(java.lang.String)} */ public ListenableFuture> getImagesByFeatureId(String featureId){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.getImagesByFeatureId( featureId,nativeCallback); return nativeCallback.feature; } public void getImagesByFeatureId(String featureId, FutureCallback>callback){ factory.addCallback(getImagesByFeatureId(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#hasFeature(byte[])} */ public ListenableFuture hasFeature(byte[] feature){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Boolean apply(Boolean input) { return input; }}); nativeCallback.service.hasFeature( TypeTransformer.getInstance().to( feature, byte[].class, okio.ByteString.class),nativeCallback); return nativeCallback.feature; } public void hasFeature(byte[] feature, FutureCallbackcallback){ factory.addCallback(hasFeature(feature), callback); } /** * see also {@link net.gdface.facedb.FaceDb#hasFeatureByMD5(java.lang.String)} */ public ListenableFuture hasFeatureByMD5(String featureId){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Boolean apply(Boolean input) { return input; }}); nativeCallback.service.hasFeatureByMD5( featureId,nativeCallback); return nativeCallback.feature; } public void hasFeatureByMD5(String featureId, FutureCallbackcallback){ factory.addCallback(hasFeatureByMD5(featureId), callback); } /** * see also {@link net.gdface.facedb.FaceDb#hasImage(java.lang.String)} */ public ListenableFuture hasImage(String imageMd5){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Boolean apply(Boolean input) { return input; }}); nativeCallback.service.hasImage( imageMd5,nativeCallback); return nativeCallback.feature; } public void hasImage(String imageMd5, FutureCallbackcallback){ factory.addCallback(hasImage(imageMd5), callback); } /** * see also {@link net.gdface.facedb.FaceDb#isLocal()} */ public boolean isLocal(){ return false; } /** * see also {@link net.gdface.facedb.FaceDb#loadFeaturesMd5ByCreateTime(java.util.Date)} */ public ListenableFuture> loadFeaturesMd5ByCreateTime(Date timestamp){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, String.class, String.class); }}); nativeCallback.service.loadFeaturesMd5ByCreateTime( TypeTransformer.getInstance().to( timestamp, Date.class, Long.class),nativeCallback); return nativeCallback.feature; } public void loadFeaturesMd5ByCreateTime(Date timestamp, FutureCallback>callback){ factory.addCallback(loadFeaturesMd5ByCreateTime(timestamp), callback); } /** * see also {@link net.gdface.facedb.FaceDb#loadFeaturesMd5ByWhere(java.lang.String)} */ public ListenableFuture> loadFeaturesMd5ByWhere(String where){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, String.class, String.class); }}); nativeCallback.service.loadFeaturesMd5ByWhere( where,nativeCallback); return nativeCallback.feature; } public void loadFeaturesMd5ByWhere(String where, FutureCallback>callback){ factory.addCallback(loadFeaturesMd5ByWhere(where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#loadImagesByWhere(java.lang.String,int,int)} */ public ListenableFuture> loadImagesByWhere(String where, int startRow, int numRows){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.ImageBean.class, ImageBean.class); }}); nativeCallback.service.loadImagesByWhere( where, startRow, numRows,nativeCallback); return nativeCallback.feature; } public void loadImagesByWhere(String where, int startRow, int numRows, FutureCallback>callback){ factory.addCallback(loadImagesByWhere(where,startRow,numRows), callback); } /** * see also {@link net.gdface.facedb.FaceDb#loadImagesMd5ByCreateTime(java.util.Date)} */ public ListenableFuture> loadImagesMd5ByCreateTime(Date timestamp){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, String.class, String.class); }}); nativeCallback.service.loadImagesMd5ByCreateTime( TypeTransformer.getInstance().to( timestamp, Date.class, Long.class),nativeCallback); return nativeCallback.feature; } public void loadImagesMd5ByCreateTime(Date timestamp, FutureCallback>callback){ factory.addCallback(loadImagesMd5ByCreateTime(timestamp), callback); } /** * see also {@link net.gdface.facedb.FaceDb#loadImagesMd5ByWhere(java.lang.String)} */ public ListenableFuture> loadImagesMd5ByWhere(String where){ MethodCallback,List> nativeCallback = new MethodCallback,List>( new Function,List>() { @Override public List apply(List input) { return TypeTransformer.getInstance().to( input, String.class, String.class); }}); nativeCallback.service.loadImagesMd5ByWhere( where,nativeCallback); return nativeCallback.feature; } public void loadImagesMd5ByWhere(String where, FutureCallback>callback){ factory.addCallback(loadImagesMd5ByWhere(where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#searchFaces(byte[],net.gdface.sdk.CodeInfo,double,int,java.lang.String)} */ public ListenableFuture searchFaces(byte[] imgData, CodeInfo facePos, double similarty, int rows, String where){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public SearchResult apply(net.gdface.facedb.thrift.client.SearchResult input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.SearchResult.class, SearchResult.class); }}); nativeCallback.service.searchFaces( TypeTransformer.getInstance().to( imgData, byte[].class, okio.ByteString.class), TypeTransformer.getInstance().to( facePos, CodeInfo.class, net.gdface.facedb.thrift.client.CodeInfo.class), similarty, rows, where,nativeCallback); return nativeCallback.feature; } public void searchFaces(byte[] imgData, CodeInfo facePos, double similarty, int rows, String where, FutureCallbackcallback){ factory.addCallback(searchFaces(imgData,facePos,similarty,rows,where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#searchFeatures(byte[],double,int,java.lang.String)} */ public ListenableFuture searchFeatures(byte[] feature, double similarty, int rows, String where){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public SearchResult apply(net.gdface.facedb.thrift.client.SearchResult input) { return TypeTransformer.getInstance().to( input, net.gdface.facedb.thrift.client.SearchResult.class, SearchResult.class); }}); nativeCallback.service.searchFeatures( TypeTransformer.getInstance().to( feature, byte[].class, okio.ByteString.class), similarty, rows, where,nativeCallback); return nativeCallback.feature; } public void searchFeatures(byte[] feature, double similarty, int rows, String where, FutureCallbackcallback){ factory.addCallback(searchFeatures(feature,similarty,rows,where), callback); } /** * see also {@link net.gdface.facedb.FaceDb#supportSearch()} */ public ListenableFuture supportSearch(){ MethodCallback nativeCallback = new MethodCallback( new Function() { @Override public Boolean apply(Boolean input) { return input; }}); nativeCallback.service.supportSearch( nativeCallback); return nativeCallback.feature; } public void supportSearch(FutureCallbackcallback){ factory.addCallback(supportSearch(), callback); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy