001// ______________________________________________________
002// Generated by codegen - https://gitee.com/l0km/codegen 
003// template: decorator/decorator.generic.class.vm
004// ______________________________________________________
005package net.gdface.sdk.fse;
006import java.io.IOException;
007import net.gdface.utils.BinaryUtils;
008/**
009 * decorator pattern 装饰者模式实现基于{@link FeatureSeDecorator}的支持泛型方法参数{@link FeatureSe}接口<br>
010 * 所有 byte[] 类型的参数都支持泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}<br>
011 * 注意:<br>
012 * 参数为{@link java.io.InputStream}的方法返回时会自动执行{@link java.io.InputStream#close()}关闭流<br>
013 * 参见 {@link net.gdface.utils.BinaryUtils#readBytes(java.io.InputStream)}<br>
014 * unchecked后缀的方法将所有显式申明的异常封装到{@link RuntimeException}抛出<br>
015 * 计算机生成代码(generated by automated tools DecoratorGenerator @author guyadong)<br>
016 * @author guyadong
017 *
018 */
019public class FeatureSeGenericDecorator extends FeatureSeDecorator{
020    public FeatureSeGenericDecorator(FeatureSe delegate) {
021        super(delegate);
022    }
023    //1
024    /**
025     * {@link FeatureSe#addFeature(byte[],byte[],java.lang.String)}对应的泛型方法<br>
026    * @param <T> T
027     * @param featureId featureId
028     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
029     * @param feature feature
030     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
031     * @param imgMD5 imgMD5
032     * @return boolean
033     * @throws IOException IOException
034     * @see FeatureSe#addFeature(byte[],byte[],java.lang.String)
035     */    
036    public <T> boolean addFeature (T featureId,T feature,String imgMD5) throws IOException{
037        return addFeature(BinaryUtils.getBytesNotEmpty(featureId),BinaryUtils.getBytesNotEmpty(feature),imgMD5);
038    }
039    //2
040    /**
041     * {@link FeatureSe#addFeature(byte[],byte[],java.lang.String)}泛型方法对应的unchecked方法,
042     * 所有显式申明的异常都被封装到{@link RuntimeException}抛出<br>
043     * @param <T> T
044     * @param featureId featureId
045     * @param feature feature
046     * @param imgMD5 imgMD5
047     * @return boolean
048     */
049    public <T> boolean addFeatureUnchecked (T featureId,T feature,String imgMD5) {
050        try{
051            return addFeature(featureId,feature,imgMD5);
052        } catch(RuntimeException e){
053            throw e;
054        } catch(Exception e){
055            throw new RuntimeException(e);
056        }
057    }
058    //3
059    /**
060     * {@link FeatureSe#addFeature(byte[],byte[],long)}对应的泛型方法<br>
061    * @param <T> T
062     * @param featureId featureId
063     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
064     * @param feature feature
065     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
066     * @param appid appid
067     * @return boolean
068     * @throws IOException IOException
069     * @see FeatureSe#addFeature(byte[],byte[],long)
070     */    
071    public <T> boolean addFeature (T featureId,T feature,long appid) throws IOException{
072        return addFeature(BinaryUtils.getBytesNotEmpty(featureId),BinaryUtils.getBytesNotEmpty(feature),appid);
073    }
074    //4
075    /**
076     * {@link FeatureSe#addFeature(byte[],byte[],long)}泛型方法对应的unchecked方法,
077     * 所有显式申明的异常都被封装到{@link RuntimeException}抛出<br>
078     * @param <T> T
079     * @param featureId featureId
080     * @param feature feature
081     * @param appid appid
082     * @return boolean
083     */
084    public <T> boolean addFeatureUnchecked (T featureId,T feature,long appid) {
085        try{
086            return addFeature(featureId,feature,appid);
087        } catch(RuntimeException e){
088            throw e;
089        } catch(Exception e){
090            throw new RuntimeException(e);
091        }
092    }
093    //5
094    /**
095     * {@link FeatureSe#getFeature(byte[])}对应的泛型方法<br>
096    * @param <T> T
097     * @param featureId featureId
098     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
099     * @return CodeBean
100     * @throws IOException IOException
101     * @see FeatureSe#getFeature(byte[])
102     */    
103    public <T> CodeBean getFeature (T featureId) throws IOException{
104        return getFeature(BinaryUtils.getBytesNotEmpty(featureId));
105    }
106    //6
107    /**
108     * {@link FeatureSe#getFeature(byte[])}泛型方法对应的unchecked方法,
109     * 所有显式申明的异常都被封装到{@link RuntimeException}抛出<br>
110     * @param <T> T
111     * @param featureId featureId
112     * @return CodeBean
113     */
114    public <T> CodeBean getFeatureUnchecked (T featureId) {
115        try{
116            return getFeature(featureId);
117        } catch(RuntimeException e){
118            throw e;
119        } catch(Exception e){
120            throw new RuntimeException(e);
121        }
122    }
123    //7
124    /**
125     * {@link FeatureSe#removeFeature(byte[])}对应的泛型方法<br>
126    * @param <T> T
127     * @param featureId featureId
128     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
129     * @return boolean
130     * @throws IOException IOException
131     * @see FeatureSe#removeFeature(byte[])
132     */    
133    public <T> boolean removeFeature (T featureId) throws IOException{
134        return removeFeature(BinaryUtils.getBytesNotEmpty(featureId));
135    }
136    //8
137    /**
138     * {@link FeatureSe#removeFeature(byte[])}泛型方法对应的unchecked方法,
139     * 所有显式申明的异常都被封装到{@link RuntimeException}抛出<br>
140     * @param <T> T
141     * @param featureId featureId
142     * @return boolean
143     */
144    public <T> boolean removeFeatureUnchecked (T featureId) {
145        try{
146            return removeFeature(featureId);
147        } catch(RuntimeException e){
148            throw e;
149        } catch(Exception e){
150            throw new RuntimeException(e);
151        }
152    }
153    //9
154    /**
155     * {@link FeatureSe#searchCode(byte[],double,int)}对应的泛型方法<br>
156    * @param <T> T
157     * @param code code
158     *            泛型参数,参见 {@link net.gdface.utils.BinaryUtils#getBytesNotEmpty(Object)}
159     * @param sim sim
160     * @param rows rows
161     * @return CodeBean[]
162     * @throws IOException IOException
163     * @see FeatureSe#searchCode(byte[],double,int)
164     */    
165    public <T> CodeBean[] searchCode (T code,double sim,int rows) throws IOException{
166        return searchCode(BinaryUtils.getBytesNotEmpty(code),sim,rows);
167    }
168    //10
169    /**
170     * {@link FeatureSe#searchCode(byte[],double,int)}泛型方法对应的unchecked方法,
171     * 所有显式申明的异常都被封装到{@link RuntimeException}抛出<br>
172     * @param <T> T
173     * @param code code
174     * @param sim sim
175     * @param rows rows
176     * @return CodeBean[]
177     */
178    public <T> CodeBean[] searchCodeUnchecked (T code,double sim,int rows) {
179        try{
180            return searchCode(code,sim,rows);
181        } catch(RuntimeException e){
182            throw e;
183        } catch(Exception e){
184            throw new RuntimeException(e);
185        }
186    }
187
188}