net.gdface.sdk.decorator.FseResult Maven / Gradle / Ivy
The newest version!
// ______________________________________________________
// Generated by codegen - https://gitee.com/l0km/codegen
// template: thrift/service/perstruct/bean.decorator.class.vm
// ______________________________________________________
package net.gdface.sdk.decorator;
import com.gitee.l0km.xthrift.base.ThriftDecorator;
import java.nio.ByteBuffer;
import com.facebook.swift.codec.ThriftStruct;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftField.Requiredness;
import com.gitee.l0km.xthrift.thrift.TypeTransformer;
/**
* FSE搜索结果对象
* 该类实现了{@link Comparable}接口,可以根据相似度结果字段({@link FseResult#getSimilarity()})排序
* @author guyadong
* ========================================
* decorator pattern 装饰者模式代理{@link net.gdface.sdk.FseResult}
* 代理对象必须有默认构造方法,必须是普通类型,不可以有@ThriftStruct注释
* 转发所有{@link net.gdface.sdk.FseResult}get/set方法到{@link #delegate()}指定的实例,
* 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)
*
*/
@ThriftStruct
public final class FseResult implements ThriftDecorator {
private final net.gdface.sdk.FseResult delegate;
public FseResult(){
this(new net.gdface.sdk.FseResult());
}
public FseResult(net.gdface.sdk.FseResult delegate) {
if(null == delegate){
throw new NullPointerException("delegate is null");
}
// 检查被装饰类是否有@ThriftStruct注释
if(delegate.getClass().isAnnotationPresent(ThriftStruct.class)){
throw new IllegalArgumentException(
String.format("NOT ALLOW %s have @ThriftStruct annotation",delegate.getClass().getName()));
}
this.delegate = delegate;
}
/**
* 返回被装饰的{@link net.gdface.sdk.FseResult}实例
*/
@Override
public net.gdface.sdk.FseResult delegate() {
return delegate;
}
@Override
public int hashCode() {
return delegate().hashCode();
}
@Override
public boolean equals(Object obj) {
return delegate().equals(obj);
}
@Override
public String toString() {
return delegate().toString();
}
@ThriftField(value = 1,name = "featureId",requiredness=Requiredness.OPTIONAL)
public ByteBuffer getFeatureId(){
return TypeTransformer.getInstance().to(
delegate().getFeatureId(),
byte[].class,
ByteBuffer.class);
}
@ThriftField
public void setFeatureId(ByteBuffer featureId){
delegate().setFeatureId(TypeTransformer.getInstance().to(
featureId,
ByteBuffer.class,
byte[].class));
}
@ThriftField(value = 2,name = "owner",requiredness=Requiredness.OPTIONAL)
public String getOwner(){
return delegate().getOwner();
}
@ThriftField
public void setOwner(String owner){
delegate().setOwner(owner);
}
@ThriftField(value = 3,name = "similarity",requiredness=Requiredness.REQUIRED)
public double getSimilarity(){
return delegate().getSimilarity();
}
@ThriftField
public void setSimilarity(double similarity){
delegate().setSimilarity(similarity);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy