001// ______________________________________________________
002// Generated by sql2java - https://github.com/10km/sql2java 
003// JDBC driver used at code generation time: com.mysql.jdbc.Driver
004// template: bean.java.vm
005// ______________________________________________________
006package net.gdface.facedb.db;
007import java.io.Serializable;
008import java.util.Objects;
009
010import gu.sql2java.BaseRow;
011
012import com.facebook.swift.codec.ThriftStruct;
013import com.facebook.swift.codec.ThriftField;
014import com.facebook.swift.codec.ThriftField.Requiredness;
015import io.swagger.annotations.ApiModel;
016import io.swagger.annotations.ApiModelProperty;
017import com.fasterxml.jackson.annotation.JsonProperty;
018import com.fasterxml.jackson.annotation.JsonIgnore;
019/**
020 * FeatureBean is a mapping of fd_feature Table.
021 * <br>Meta Data Information (in progress):
022 * <ul>
023 *    <li>comments: 用于验证身份的人脸特征数据表 </li>
024 * </ul>
025 * @author guyadong
026*/
027@ThriftStruct
028@ApiModel(description="用于验证身份的人脸特征数据表")
029public final class FeatureBean extends BaseRow
030    implements Serializable,Constant
031{
032    private static final long serialVersionUID = 932068192335281810L;
033
034    /** comments:主键,特征码md5校验码 */
035    @ApiModelProperty(value = "主键,特征码md5校验码" ,required=true ,dataType="String")
036    private String md5;
037
038    /** comments:二进制特征数据 */
039    @ApiModelProperty(value = "二进制特征数据" ,required=true ,dataType="ByteBuffer")
040    private java.nio.ByteBuffer feature;
041
042    @ApiModelProperty(value = "create_time"  ,dataType="Date")
043    private java.util.Date createTime;
044
045    /** columns modified flag */
046    @ApiModelProperty(value="columns modified flag",dataType="int",required=true)
047    private int modified;
048    /** columns initialized flag */
049    @ApiModelProperty(value="columns initialized flag",dataType="int",required=true)
050    private int initialized;
051    /** new record flag  */
052    @ApiModelProperty(value="new record flag",dataType="boolean",required=true)
053    private boolean isNew;        
054    @ThriftField(value=1,name="_new",requiredness=Requiredness.REQUIRED)
055    @Override
056    public boolean isNew()
057    {
058        return this.isNew;
059    }
060
061    /**
062     * Specifies to the object if it has been set as new.
063     *
064     * @param isNew the boolean value to be assigned to the isNew field
065     */
066    @ThriftField()
067    @Override
068    public void setNew(boolean isNew)
069    {
070        this.isNew = isNew;
071    }
072    /**
073     * @return the modified status of columns
074     */
075    @ThriftField(value=2,requiredness=Requiredness.REQUIRED)
076    @Override
077    public int getModified(){
078        return modified;
079    }
080
081    /**
082     * @param modified the modified status bit to be assigned to {@link #modified}
083     */
084    @ThriftField()
085    @Override
086    public void setModified(int modified){
087        this.modified = modified;
088    }
089    /**
090     * @return the initialized status of columns
091     */
092    @ThriftField(value=3,requiredness=Requiredness.REQUIRED)
093    @Override
094    public int getInitialized(){
095        return initialized;
096    }
097
098    /**
099     * @param initialized the initialized status bit to be assigned to {@link #initialized}
100     */
101    @ThriftField()
102    @Override
103    public void setInitialized(int initialized){
104        this.initialized = initialized;
105    }
106
107    public FeatureBean(){
108        reset();
109    }
110    /**
111     * construct a new instance filled with primary keys
112     * @param md5 PK# 1 
113     */
114    public FeatureBean(String md5){
115        setMd5(md5);
116    }
117    /**
118     * Getter method for {@link #md5}.<br>
119     * PRIMARY KEY.<br>
120     * Meta Data Information (in progress):
121     * <ul>
122     * <li>full name: fd_feature.md5</li>
123     * <li> imported key: fd_face.feature_md5</li>
124     * <li>comments: 主键,特征码md5校验码</li>
125     * <li>NOT NULL</li>
126     * <li>column size: 32</li>
127     * <li>JDBC type returned by the driver: Types.CHAR</li>
128     * </ul>
129     *
130     * @return the value of md5
131     */
132    @ThriftField(value=4)
133    @JsonProperty("md5")
134    public String getMd5(){
135        return md5;
136    }
137    /**
138     * Setter method for {@link #md5}.<br>
139     * The new value is set only if equals() says it is different,
140     * or if one of either the new value or the current value is null.
141     * In case the new value is different, it is set and the field is marked as 'modified'.
142     *
143     * @param newVal the new value( NOT NULL) to be assigned to md5
144     */
145    @ThriftField(name="md5")
146    @JsonProperty("md5")
147    public void setMd5(String newVal)
148    {
149        modified |= FD_FEATURE_ID_MD5_MASK;
150        initialized |= FD_FEATURE_ID_MD5_MASK;
151
152        if (Objects.equals(newVal, md5)) {
153            return;
154        }
155        md5 = newVal;
156    }
157    /**
158     * Determines if the md5 has been modified.
159     *
160     * @return true if the field has been modified, false if the field has not been modified
161     */
162    public boolean checkMd5Modified()
163    {
164        return 0 !=  (modified & FD_FEATURE_ID_MD5_MASK);
165    }
166
167    /**
168     * Determines if the md5 has been initialized.<br>
169     *
170     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
171     *
172     * @return true if the field has been initialized, false otherwise
173     */
174    public boolean checkMd5Initialized()
175    {
176        return 0 !=  (initialized & FD_FEATURE_ID_MD5_MASK);
177    }
178    /**
179     * Getter method for {@link #feature}.<br>
180     * Meta Data Information (in progress):
181     * <ul>
182     * <li>full name: fd_feature.feature</li>
183     * <li>comments: 二进制特征数据</li>
184     * <li>NOT NULL</li>
185     * <li>column size: 65535</li>
186     * <li>JDBC type returned by the driver: Types.LONGVARBINARY</li>
187     * </ul>
188     *
189     * @return the value of feature
190     */
191    @ThriftField(value=5)
192    @JsonProperty("feature")
193    public java.nio.ByteBuffer getFeature(){
194        return feature;
195    }
196    /**
197     * Setter method for {@link #feature}.<br>
198     * The new value is set only if equals() says it is different,
199     * or if one of either the new value or the current value is null.
200     * In case the new value is different, it is set and the field is marked as 'modified'.
201     *
202     * @param newVal the new value( NOT NULL) to be assigned to feature
203     */
204    @ThriftField(name="feature")
205    @JsonProperty("feature")
206    public void setFeature(java.nio.ByteBuffer newVal)
207    {
208        modified |= FD_FEATURE_ID_FEATURE_MASK;
209        initialized |= FD_FEATURE_ID_FEATURE_MASK;
210
211        if (Objects.equals(newVal, feature)) {
212            return;
213        }
214        feature = newVal;
215    }
216    /**
217     * Determines if the feature has been modified.
218     *
219     * @return true if the field has been modified, false if the field has not been modified
220     */
221    public boolean checkFeatureModified()
222    {
223        return 0 !=  (modified & FD_FEATURE_ID_FEATURE_MASK);
224    }
225
226    /**
227     * Determines if the feature has been initialized.<br>
228     *
229     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
230     *
231     * @return true if the field has been initialized, false otherwise
232     */
233    public boolean checkFeatureInitialized()
234    {
235        return 0 !=  (initialized & FD_FEATURE_ID_FEATURE_MASK);
236    }
237    /**
238     * Getter method for {@link #createTime}.<br>
239     * Meta Data Information (in progress):
240     * <ul>
241     * <li>full name: fd_feature.create_time</li>
242     * <li>default value: 'CURRENT_TIMESTAMP'</li>
243     * <li>NOT NULL</li>
244     * <li>column size: 19</li>
245     * <li>JDBC type returned by the driver: Types.TIMESTAMP</li>
246     * </ul>
247     *
248     * @return the value of createTime
249     */
250    @JsonIgnore
251    public java.util.Date getCreateTime(){
252        return createTime;
253    }
254    /** 
255     * use Long to represent date type for thrift:swift support 
256     * @see #getCreateTime()
257     */
258    @ThriftField(value=6,name="createTime")
259    @JsonProperty("createTime")
260    public Long readCreateTime(){
261        return null == createTime ? null:createTime.getTime();
262    }
263    /**
264     * Setter method for {@link #createTime}.<br>
265     * The new value is set only if equals() says it is different,
266     * or if one of either the new value or the current value is null.
267     * In case the new value is different, it is set and the field is marked as 'modified'.
268     *
269     * @param newVal the new value( NOT NULL) to be assigned to createTime
270     */
271    @JsonIgnore
272    public void setCreateTime(java.util.Date newVal)
273    {
274        modified |= FD_FEATURE_ID_CREATE_TIME_MASK;
275        initialized |= FD_FEATURE_ID_CREATE_TIME_MASK;
276
277        if (Objects.equals(newVal, createTime)) {
278            return;
279        }
280        createTime = newVal;
281    }
282    /** 
283     * setter for thrift:swift OR jackson support<br>
284     * without modification for {@link #modified} and {@link #initialized}<br>
285     * <b>NOTE:</b>DO NOT use the method in your code
286     */
287    @ThriftField(name="createTime")
288    @JsonProperty("createTime")
289    public void writeCreateTime(Long newVal){
290        createTime = null == newVal?null:new java.util.Date(newVal);
291    }
292    /**
293     * Setter method for {@link #createTime}.<br>
294     * Convenient for those who do not want to deal with Objects for primary types.
295     *
296     * @param newVal the new value to be assigned to createTime
297     */
298    @JsonIgnore
299    public void setCreateTime(long newVal)
300    {
301        setCreateTime(new java.util.Date(newVal));
302    }
303    /**
304     * Setter method for {@link #createTime}.<br>
305     * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
306     */
307    @JsonIgnore
308    public void setCreateTime(Long newVal)
309    {
310        setCreateTime(null == newVal ? null : new java.util.Date(newVal));
311    }
312    /**
313     * Determines if the createTime has been modified.
314     *
315     * @return true if the field has been modified, false if the field has not been modified
316     */
317    public boolean checkCreateTimeModified()
318    {
319        return 0 !=  (modified & FD_FEATURE_ID_CREATE_TIME_MASK);
320    }
321
322    /**
323     * Determines if the createTime has been initialized.<br>
324     *
325     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
326     *
327     * @return true if the field has been initialized, false otherwise
328     */
329    public boolean checkCreateTimeInitialized()
330    {
331        return 0 !=  (initialized & FD_FEATURE_ID_CREATE_TIME_MASK);
332    }
333
334    @Override
335    public boolean beModified()
336    {
337        return 0 != modified;
338    }
339  
340    @Override
341    public boolean isModified(int columnID){
342        return columnID>=0 && columnID < metaData.columnCount && 0 !=  (modified & (1 << columnID));
343    }
344
345    @Override
346    public boolean isInitialized(int columnID){
347        return columnID>=0 && columnID < metaData.columnCount && 0 !=  (initialized & (1 << columnID));
348    }
349    
350    @Override
351    public void resetIsModified()
352    {
353        modified = 0;
354    }
355
356    @Override
357    public void resetPrimaryKeysModified()
358    {
359        modified &= (~(FD_FEATURE_ID_MD5_MASK));
360    }
361    /**
362     * Resets columns modification status except primary keys to 'not modified'.
363     */
364    public void resetModifiedExceptPrimaryKeys()
365    {
366        modified &= (~(FD_FEATURE_ID_FEATURE_MASK |
367            FD_FEATURE_ID_CREATE_TIME_MASK));
368    }
369
370    /** reset all fields to initial value, equal to a new bean */
371    public void reset(){
372        this.md5 = null;
373        this.feature = null;
374        /* DEFAULT:'CURRENT_TIMESTAMP'*/
375        this.createTime = null;
376        this.isNew = true;
377        this.modified = 0;
378        this.initialized = 0;
379    }
380
381    @Override
382    public FeatureBean clone(){
383        return (FeatureBean) super.clone();
384    }
385
386
387    public static final Builder builder(){
388        return new Builder().reset();
389    }
390    /** 
391     * a builder for FeatureBean,the template instance is thread local variable
392     * a instance of Builder can be reused.
393     */
394    public static final class Builder{
395        /** FeatureBean instance used for template to create new FeatureBean instance. */
396        static final ThreadLocal<FeatureBean> TEMPLATE = new ThreadLocal<FeatureBean>(){
397            @Override
398            protected FeatureBean initialValue() {
399                return new FeatureBean();
400            }};
401        private Builder() {}
402        /** 
403         * reset the bean as template 
404         * @see FeatureBean#reset()
405         */
406        public Builder reset(){
407            TEMPLATE.get().reset();
408            return this;
409        }
410        /** set a bean as template,must not be {@code null} */
411        public Builder template(FeatureBean bean){
412            if(null == bean){
413                throw new NullPointerException();
414            }
415            TEMPLATE.set(bean);
416            return this;
417        }
418        /** return a clone instance of {@link #TEMPLATE}*/
419        public FeatureBean build(){
420            return TEMPLATE.get().clone();
421        }
422        /** 
423         * fill the field : fd_feature.md5
424         * @param md5 主键,特征码md5校验码
425         * @see FeatureBean#getMd5()
426         * @see FeatureBean#setMd5(String)
427         */
428        public Builder md5(String md5){
429            TEMPLATE.get().setMd5(md5);
430            return this;
431        }
432        /** 
433         * fill the field : fd_feature.feature
434         * @param feature 二进制特征数据
435         * @see FeatureBean#getFeature()
436         * @see FeatureBean#setFeature(java.nio.ByteBuffer)
437         */
438        public Builder feature(java.nio.ByteBuffer feature){
439            TEMPLATE.get().setFeature(feature);
440            return this;
441        }
442        /** 
443         * fill the field : fd_feature.create_time
444         * @param createTime 
445         * @see FeatureBean#getCreateTime()
446         * @see FeatureBean#setCreateTime(java.util.Date)
447         */
448        public Builder createTime(java.util.Date createTime){
449            TEMPLATE.get().setCreateTime(createTime);
450            return this;
451        }
452    }
453}