001// ______________________________________________________ 002// Generated by codegen - https://gitee.com/l0km/codegen 003// template: thrift/client/perstruct/bean.decorator.class.vm 004// ______________________________________________________ 005package net.gdface.sdk.decorator.client; 006import net.gdface.sdk.CodeInfo; 007import net.gdface.thrift.ThriftDecorator; 008import net.gdface.thrift.TypeTransformer; 009import com.facebook.swift.codec.ThriftStruct; 010import com.facebook.swift.codec.ThriftField; 011import com.facebook.swift.codec.ThriftField.Requiredness; 012/** 013 * decorator pattern 装饰者模式client端代理{@link net.gdface.sdk.CompareResult}<br> 014 * 代理对象必须有默认构造方法,必须是普通类型,不可以有@ThriftStruct注释<br> 015 * 转发所有{@link net.gdface.sdk.CompareResult}get/set方法到{@link #delegate()}指定的实例,<br> 016 * 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)<br> 017 * @author guyadong 018 * 019 */ 020@ThriftStruct 021public final class CompareResult implements ThriftDecorator<net.gdface.sdk.CompareResult> { 022 private final net.gdface.sdk.CompareResult delegate; 023 024 public CompareResult(){ 025 this(new net.gdface.sdk.CompareResult()); 026 } 027 public CompareResult(net.gdface.sdk.CompareResult delegate) { 028 if(null == delegate){ 029 throw new NullPointerException("delegate is null"); 030 } 031 // 检查被装饰类是否有@ThriftStruct注释 032 if(delegate.getClass().isAnnotationPresent(ThriftStruct.class)){ 033 throw new IllegalArgumentException( 034 String.format("NOT ALLOW %s have @ThriftStruct annotation",delegate.getClass().getName())); 035 } 036 this.delegate = delegate; 037 } 038 039 /** 040 * @return 返回被装饰的{@link net.gdface.sdk.CompareResult}实例 041 */ 042 @Override 043 public net.gdface.sdk.CompareResult delegate() { 044 return delegate; 045 } 046 @Override 047 public int hashCode() { 048 return delegate().hashCode(); 049 } 050 @Override 051 public boolean equals(Object obj) { 052 return delegate().equals(obj); 053 } 054 @Override 055 public String toString() { 056 return delegate().toString(); 057 } 058 @ThriftField(value = 1,requiredness=Requiredness.OPTIONAL) 059 public java.util.List<net.gdface.sdk.thrift.client.CodeInfo> getCodes(){ 060 return TypeTransformer.getInstance().to( 061 delegate().getCodes(), 062 CodeInfo.class, 063 net.gdface.sdk.thrift.client.CodeInfo.class); 064 } 065 066 @ThriftField 067 public void setCodes(java.util.List<net.gdface.sdk.thrift.client.CodeInfo> value){ 068 delegate().setCodes(TypeTransformer.getInstance().toArray( 069 value, 070 net.gdface.sdk.thrift.client.CodeInfo.class, 071 CodeInfo.class)); 072 } 073 074 @ThriftField(value = 2,requiredness=Requiredness.OPTIONAL) 075 public java.util.List<Double> getSimilartys(){ 076 return TypeTransformer.getInstance().to( 077 delegate().getSimilartys(), 078 double.class, 079 double.class); 080 } 081 082 @ThriftField 083 public void setSimilartys(java.util.List<Double> value){ 084 delegate().setSimilartys(TypeTransformer.getInstance().todoubleArray( 085 value, 086 double.class, 087 double.class)); 088 } 089 090}