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 * ImageBean is a mapping of fd_image Table.
021 * <br>Meta Data Information (in progress):
022 * <ul>
023 *    <li>comments: 图像信息存储表,用于存储系统中所有用到的图像数据,表中只包含图像基本信息,图像二进制源数据存在在fd_store中(md5对应) </li>
024 * </ul>
025 * @author guyadong
026*/
027@ThriftStruct
028@ApiModel(description="图像信息存储表,用于存储系统中所有用到的图像数据,表中只包含图像基本信息,图像二进制源数据存在在fd_store中(md5对应)")
029public final class ImageBean extends BaseRow
030    implements Serializable,Constant
031{
032    private static final long serialVersionUID = -5562592083876692784L;
033
034    /** comments:主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key */
035    @ApiModelProperty(value = "主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key" ,required=true ,dataType="String")
036    private String md5;
037
038    /** comments:图像格式 */
039    @ApiModelProperty(value = "图像格式"  ,dataType="String")
040    private String format;
041
042    /** comments:图像宽度 */
043    @ApiModelProperty(value = "图像宽度" ,required=true ,dataType="Integer")
044    private Integer width;
045
046    /** comments:图像高度 */
047    @ApiModelProperty(value = "图像高度" ,required=true ,dataType="Integer")
048    private Integer height;
049
050    /** comments:通道数 */
051    @ApiModelProperty(value = "通道数"  ,dataType="Integer")
052    private Integer depth;
053
054    /** comments:图像中的人脸数目 */
055    @ApiModelProperty(value = "图像中的人脸数目"  ,dataType="Integer")
056    private Integer faceNum;
057
058    @ApiModelProperty(value = "update_time"  ,dataType="Date")
059    private java.util.Date updateTime;
060
061    @ApiModelProperty(value = "create_time"  ,dataType="Date")
062    private java.util.Date createTime;
063
064    /** columns modified flag */
065    @ApiModelProperty(value="columns modified flag",dataType="int",required=true)
066    private int modified;
067    /** columns initialized flag */
068    @ApiModelProperty(value="columns initialized flag",dataType="int",required=true)
069    private int initialized;
070    /** new record flag  */
071    @ApiModelProperty(value="new record flag",dataType="boolean",required=true)
072    private boolean isNew;        
073    @ThriftField(value=1,name="_new",requiredness=Requiredness.REQUIRED)
074    @Override
075    public boolean isNew()
076    {
077        return this.isNew;
078    }
079
080    /**
081     * Specifies to the object if it has been set as new.
082     *
083     * @param isNew the boolean value to be assigned to the isNew field
084     */
085    @ThriftField()
086    @Override
087    public void setNew(boolean isNew)
088    {
089        this.isNew = isNew;
090    }
091    /**
092     * @return the modified status of columns
093     */
094    @ThriftField(value=2,requiredness=Requiredness.REQUIRED)
095    @Override
096    public int getModified(){
097        return modified;
098    }
099
100    /**
101     * @param modified the modified status bit to be assigned to {@link #modified}
102     */
103    @ThriftField()
104    @Override
105    public void setModified(int modified){
106        this.modified = modified;
107    }
108    /**
109     * @return the initialized status of columns
110     */
111    @ThriftField(value=3,requiredness=Requiredness.REQUIRED)
112    @Override
113    public int getInitialized(){
114        return initialized;
115    }
116
117    /**
118     * @param initialized the initialized status bit to be assigned to {@link #initialized}
119     */
120    @ThriftField()
121    @Override
122    public void setInitialized(int initialized){
123        this.initialized = initialized;
124    }
125
126    public ImageBean(){
127        reset();
128    }
129    /**
130     * construct a new instance filled with primary keys
131     * @param md5 PK# 1 
132     */
133    public ImageBean(String md5){
134        setMd5(md5);
135    }
136    /**
137     * Getter method for {@link #md5}.<br>
138     * PRIMARY KEY.<br>
139     * Meta Data Information (in progress):
140     * <ul>
141     * <li>full name: fd_image.md5</li>
142     * <li> imported key: fd_face.image_md5</li>
143     * <li>comments: 主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key</li>
144     * <li>NOT NULL</li>
145     * <li>column size: 32</li>
146     * <li>JDBC type returned by the driver: Types.CHAR</li>
147     * </ul>
148     *
149     * @return the value of md5
150     */
151    @ThriftField(value=4)
152    @JsonProperty("md5")
153    public String getMd5(){
154        return md5;
155    }
156    /**
157     * Setter method for {@link #md5}.<br>
158     * The new value is set only if equals() says it is different,
159     * or if one of either the new value or the current value is null.
160     * In case the new value is different, it is set and the field is marked as 'modified'.
161     *
162     * @param newVal the new value( NOT NULL) to be assigned to md5
163     */
164    @ThriftField(name="md5")
165    @JsonProperty("md5")
166    public void setMd5(String newVal)
167    {
168        modified |= FD_IMAGE_ID_MD5_MASK;
169        initialized |= FD_IMAGE_ID_MD5_MASK;
170
171        if (Objects.equals(newVal, md5)) {
172            return;
173        }
174        md5 = newVal;
175    }
176    /**
177     * Determines if the md5 has been modified.
178     *
179     * @return true if the field has been modified, false if the field has not been modified
180     */
181    public boolean checkMd5Modified()
182    {
183        return 0 !=  (modified & FD_IMAGE_ID_MD5_MASK);
184    }
185
186    /**
187     * Determines if the md5 has been initialized.<br>
188     *
189     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
190     *
191     * @return true if the field has been initialized, false otherwise
192     */
193    public boolean checkMd5Initialized()
194    {
195        return 0 !=  (initialized & FD_IMAGE_ID_MD5_MASK);
196    }
197    /**
198     * Getter method for {@link #format}.<br>
199     * Meta Data Information (in progress):
200     * <ul>
201     * <li>full name: fd_image.format</li>
202     * <li>comments: 图像格式</li>
203     * <li>column size: 32</li>
204     * <li>JDBC type returned by the driver: Types.VARCHAR</li>
205     * </ul>
206     *
207     * @return the value of format
208     */
209    @ThriftField(value=5)
210    @JsonProperty("format")
211    public String getFormat(){
212        return format;
213    }
214    /**
215     * Setter method for {@link #format}.<br>
216     * The new value is set only if equals() says it is different,
217     * or if one of either the new value or the current value is null.
218     * In case the new value is different, it is set and the field is marked as 'modified'.
219     *
220     * @param newVal the new value to be assigned to format
221     */
222    @ThriftField(name="format")
223    @JsonProperty("format")
224    public void setFormat(String newVal)
225    {
226        modified |= FD_IMAGE_ID_FORMAT_MASK;
227        initialized |= FD_IMAGE_ID_FORMAT_MASK;
228
229        if (Objects.equals(newVal, format)) {
230            return;
231        }
232        format = newVal;
233    }
234    /**
235     * Determines if the format has been modified.
236     *
237     * @return true if the field has been modified, false if the field has not been modified
238     */
239    public boolean checkFormatModified()
240    {
241        return 0 !=  (modified & FD_IMAGE_ID_FORMAT_MASK);
242    }
243
244    /**
245     * Determines if the format has been initialized.<br>
246     *
247     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
248     *
249     * @return true if the field has been initialized, false otherwise
250     */
251    public boolean checkFormatInitialized()
252    {
253        return 0 !=  (initialized & FD_IMAGE_ID_FORMAT_MASK);
254    }
255    /**
256     * Getter method for {@link #width}.<br>
257     * Meta Data Information (in progress):
258     * <ul>
259     * <li>full name: fd_image.width</li>
260     * <li>comments: 图像宽度</li>
261     * <li>NOT NULL</li>
262     * <li>column size: 10</li>
263     * <li>JDBC type returned by the driver: Types.INTEGER</li>
264     * </ul>
265     *
266     * @return the value of width
267     */
268    @ThriftField(value=6)
269    @JsonProperty("width")
270    public Integer getWidth(){
271        return width;
272    }
273    /**
274     * Setter method for {@link #width}.<br>
275     * The new value is set only if equals() says it is different,
276     * or if one of either the new value or the current value is null.
277     * In case the new value is different, it is set and the field is marked as 'modified'.
278     *
279     * @param newVal the new value( NOT NULL) to be assigned to width
280     */
281    @ThriftField(name="width")
282    @JsonProperty("width")
283    public void setWidth(Integer newVal)
284    {
285        modified |= FD_IMAGE_ID_WIDTH_MASK;
286        initialized |= FD_IMAGE_ID_WIDTH_MASK;
287
288        if (Objects.equals(newVal, width)) {
289            return;
290        }
291        width = newVal;
292    }
293    /**
294     * Setter method for {@link #width}.<br>
295     * Convenient for those who do not want to deal with Objects for primary types.
296     *
297     * @param newVal the new value to be assigned to width
298     */
299    @JsonIgnore
300    public void setWidth(int newVal)
301    {
302        setWidth(new Integer(newVal));
303    }
304    /**
305     * Determines if the width has been modified.
306     *
307     * @return true if the field has been modified, false if the field has not been modified
308     */
309    public boolean checkWidthModified()
310    {
311        return 0 !=  (modified & FD_IMAGE_ID_WIDTH_MASK);
312    }
313
314    /**
315     * Determines if the width has been initialized.<br>
316     *
317     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
318     *
319     * @return true if the field has been initialized, false otherwise
320     */
321    public boolean checkWidthInitialized()
322    {
323        return 0 !=  (initialized & FD_IMAGE_ID_WIDTH_MASK);
324    }
325    /**
326     * Getter method for {@link #height}.<br>
327     * Meta Data Information (in progress):
328     * <ul>
329     * <li>full name: fd_image.height</li>
330     * <li>comments: 图像高度</li>
331     * <li>NOT NULL</li>
332     * <li>column size: 10</li>
333     * <li>JDBC type returned by the driver: Types.INTEGER</li>
334     * </ul>
335     *
336     * @return the value of height
337     */
338    @ThriftField(value=7)
339    @JsonProperty("height")
340    public Integer getHeight(){
341        return height;
342    }
343    /**
344     * Setter method for {@link #height}.<br>
345     * The new value is set only if equals() says it is different,
346     * or if one of either the new value or the current value is null.
347     * In case the new value is different, it is set and the field is marked as 'modified'.
348     *
349     * @param newVal the new value( NOT NULL) to be assigned to height
350     */
351    @ThriftField(name="height")
352    @JsonProperty("height")
353    public void setHeight(Integer newVal)
354    {
355        modified |= FD_IMAGE_ID_HEIGHT_MASK;
356        initialized |= FD_IMAGE_ID_HEIGHT_MASK;
357
358        if (Objects.equals(newVal, height)) {
359            return;
360        }
361        height = newVal;
362    }
363    /**
364     * Setter method for {@link #height}.<br>
365     * Convenient for those who do not want to deal with Objects for primary types.
366     *
367     * @param newVal the new value to be assigned to height
368     */
369    @JsonIgnore
370    public void setHeight(int newVal)
371    {
372        setHeight(new Integer(newVal));
373    }
374    /**
375     * Determines if the height has been modified.
376     *
377     * @return true if the field has been modified, false if the field has not been modified
378     */
379    public boolean checkHeightModified()
380    {
381        return 0 !=  (modified & FD_IMAGE_ID_HEIGHT_MASK);
382    }
383
384    /**
385     * Determines if the height has been initialized.<br>
386     *
387     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
388     *
389     * @return true if the field has been initialized, false otherwise
390     */
391    public boolean checkHeightInitialized()
392    {
393        return 0 !=  (initialized & FD_IMAGE_ID_HEIGHT_MASK);
394    }
395    /**
396     * Getter method for {@link #depth}.<br>
397     * Meta Data Information (in progress):
398     * <ul>
399     * <li>full name: fd_image.depth</li>
400     * <li>comments: 通道数</li>
401     * <li>default value: '0'</li>
402     * <li>NOT NULL</li>
403     * <li>column size: 10</li>
404     * <li>JDBC type returned by the driver: Types.INTEGER</li>
405     * </ul>
406     *
407     * @return the value of depth
408     */
409    @ThriftField(value=8)
410    @JsonProperty("depth")
411    public Integer getDepth(){
412        return depth;
413    }
414    /**
415     * Setter method for {@link #depth}.<br>
416     * The new value is set only if equals() says it is different,
417     * or if one of either the new value or the current value is null.
418     * In case the new value is different, it is set and the field is marked as 'modified'.
419     *
420     * @param newVal the new value( NOT NULL) to be assigned to depth
421     */
422    @ThriftField(name="depth")
423    @JsonProperty("depth")
424    public void setDepth(Integer newVal)
425    {
426        modified |= FD_IMAGE_ID_DEPTH_MASK;
427        initialized |= FD_IMAGE_ID_DEPTH_MASK;
428
429        if (Objects.equals(newVal, depth)) {
430            return;
431        }
432        depth = newVal;
433    }
434    /**
435     * Setter method for {@link #depth}.<br>
436     * Convenient for those who do not want to deal with Objects for primary types.
437     *
438     * @param newVal the new value to be assigned to depth
439     */
440    @JsonIgnore
441    public void setDepth(int newVal)
442    {
443        setDepth(new Integer(newVal));
444    }
445    /**
446     * Determines if the depth has been modified.
447     *
448     * @return true if the field has been modified, false if the field has not been modified
449     */
450    public boolean checkDepthModified()
451    {
452        return 0 !=  (modified & FD_IMAGE_ID_DEPTH_MASK);
453    }
454
455    /**
456     * Determines if the depth has been initialized.<br>
457     *
458     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
459     *
460     * @return true if the field has been initialized, false otherwise
461     */
462    public boolean checkDepthInitialized()
463    {
464        return 0 !=  (initialized & FD_IMAGE_ID_DEPTH_MASK);
465    }
466    /**
467     * Getter method for {@link #faceNum}.<br>
468     * Meta Data Information (in progress):
469     * <ul>
470     * <li>full name: fd_image.face_num</li>
471     * <li>comments: 图像中的人脸数目</li>
472     * <li>default value: '0'</li>
473     * <li>NOT NULL</li>
474     * <li>column size: 10</li>
475     * <li>JDBC type returned by the driver: Types.INTEGER</li>
476     * </ul>
477     *
478     * @return the value of faceNum
479     */
480    @ThriftField(value=9)
481    @JsonProperty("faceNum")
482    public Integer getFaceNum(){
483        return faceNum;
484    }
485    /**
486     * Setter method for {@link #faceNum}.<br>
487     * The new value is set only if equals() says it is different,
488     * or if one of either the new value or the current value is null.
489     * In case the new value is different, it is set and the field is marked as 'modified'.
490     *
491     * @param newVal the new value( NOT NULL) to be assigned to faceNum
492     */
493    @ThriftField(name="faceNum")
494    @JsonProperty("faceNum")
495    public void setFaceNum(Integer newVal)
496    {
497        modified |= FD_IMAGE_ID_FACE_NUM_MASK;
498        initialized |= FD_IMAGE_ID_FACE_NUM_MASK;
499
500        if (Objects.equals(newVal, faceNum)) {
501            return;
502        }
503        faceNum = newVal;
504    }
505    /**
506     * Setter method for {@link #faceNum}.<br>
507     * Convenient for those who do not want to deal with Objects for primary types.
508     *
509     * @param newVal the new value to be assigned to faceNum
510     */
511    @JsonIgnore
512    public void setFaceNum(int newVal)
513    {
514        setFaceNum(new Integer(newVal));
515    }
516    /**
517     * Determines if the faceNum has been modified.
518     *
519     * @return true if the field has been modified, false if the field has not been modified
520     */
521    public boolean checkFaceNumModified()
522    {
523        return 0 !=  (modified & FD_IMAGE_ID_FACE_NUM_MASK);
524    }
525
526    /**
527     * Determines if the faceNum has been initialized.<br>
528     *
529     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
530     *
531     * @return true if the field has been initialized, false otherwise
532     */
533    public boolean checkFaceNumInitialized()
534    {
535        return 0 !=  (initialized & FD_IMAGE_ID_FACE_NUM_MASK);
536    }
537    /**
538     * Getter method for {@link #updateTime}.<br>
539     * Meta Data Information (in progress):
540     * <ul>
541     * <li>full name: fd_image.update_time</li>
542     * <li>default value: 'CURRENT_TIMESTAMP'</li>
543     * <li>NOT NULL</li>
544     * <li>column size: 19</li>
545     * <li>JDBC type returned by the driver: Types.TIMESTAMP</li>
546     * </ul>
547     *
548     * @return the value of updateTime
549     */
550    @JsonIgnore
551    public java.util.Date getUpdateTime(){
552        return updateTime;
553    }
554    /** 
555     * use Long to represent date type for thrift:swift support 
556     * @see #getUpdateTime()
557     */
558    @ThriftField(value=10,name="updateTime")
559    @JsonProperty("updateTime")
560    public Long readUpdateTime(){
561        return null == updateTime ? null:updateTime.getTime();
562    }
563    /**
564     * Setter method for {@link #updateTime}.<br>
565     * The new value is set only if equals() says it is different,
566     * or if one of either the new value or the current value is null.
567     * In case the new value is different, it is set and the field is marked as 'modified'.
568     *
569     * @param newVal the new value( NOT NULL) to be assigned to updateTime
570     */
571    @JsonIgnore
572    public void setUpdateTime(java.util.Date newVal)
573    {
574        modified |= FD_IMAGE_ID_UPDATE_TIME_MASK;
575        initialized |= FD_IMAGE_ID_UPDATE_TIME_MASK;
576
577        if (Objects.equals(newVal, updateTime)) {
578            return;
579        }
580        updateTime = newVal;
581    }
582    /** 
583     * setter for thrift:swift OR jackson support<br>
584     * without modification for {@link #modified} and {@link #initialized}<br>
585     * <b>NOTE:</b>DO NOT use the method in your code
586     */
587    @ThriftField(name="updateTime")
588    @JsonProperty("updateTime")
589    public void writeUpdateTime(Long newVal){
590        updateTime = null == newVal?null:new java.util.Date(newVal);
591    }
592    /**
593     * Setter method for {@link #updateTime}.<br>
594     * Convenient for those who do not want to deal with Objects for primary types.
595     *
596     * @param newVal the new value to be assigned to updateTime
597     */
598    @JsonIgnore
599    public void setUpdateTime(long newVal)
600    {
601        setUpdateTime(new java.util.Date(newVal));
602    }
603    /**
604     * Setter method for {@link #updateTime}.<br>
605     * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
606     */
607    @JsonIgnore
608    public void setUpdateTime(Long newVal)
609    {
610        setUpdateTime(null == newVal ? null : new java.util.Date(newVal));
611    }
612    /**
613     * Determines if the updateTime has been modified.
614     *
615     * @return true if the field has been modified, false if the field has not been modified
616     */
617    public boolean checkUpdateTimeModified()
618    {
619        return 0 !=  (modified & FD_IMAGE_ID_UPDATE_TIME_MASK);
620    }
621
622    /**
623     * Determines if the updateTime has been initialized.<br>
624     *
625     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
626     *
627     * @return true if the field has been initialized, false otherwise
628     */
629    public boolean checkUpdateTimeInitialized()
630    {
631        return 0 !=  (initialized & FD_IMAGE_ID_UPDATE_TIME_MASK);
632    }
633    /**
634     * Getter method for {@link #createTime}.<br>
635     * Meta Data Information (in progress):
636     * <ul>
637     * <li>full name: fd_image.create_time</li>
638     * <li>default value: 'CURRENT_TIMESTAMP'</li>
639     * <li>NOT NULL</li>
640     * <li>column size: 19</li>
641     * <li>JDBC type returned by the driver: Types.TIMESTAMP</li>
642     * </ul>
643     *
644     * @return the value of createTime
645     */
646    @JsonIgnore
647    public java.util.Date getCreateTime(){
648        return createTime;
649    }
650    /** 
651     * use Long to represent date type for thrift:swift support 
652     * @see #getCreateTime()
653     */
654    @ThriftField(value=11,name="createTime")
655    @JsonProperty("createTime")
656    public Long readCreateTime(){
657        return null == createTime ? null:createTime.getTime();
658    }
659    /**
660     * Setter method for {@link #createTime}.<br>
661     * The new value is set only if equals() says it is different,
662     * or if one of either the new value or the current value is null.
663     * In case the new value is different, it is set and the field is marked as 'modified'.
664     *
665     * @param newVal the new value( NOT NULL) to be assigned to createTime
666     */
667    @JsonIgnore
668    public void setCreateTime(java.util.Date newVal)
669    {
670        modified |= FD_IMAGE_ID_CREATE_TIME_MASK;
671        initialized |= FD_IMAGE_ID_CREATE_TIME_MASK;
672
673        if (Objects.equals(newVal, createTime)) {
674            return;
675        }
676        createTime = newVal;
677    }
678    /** 
679     * setter for thrift:swift OR jackson support<br>
680     * without modification for {@link #modified} and {@link #initialized}<br>
681     * <b>NOTE:</b>DO NOT use the method in your code
682     */
683    @ThriftField(name="createTime")
684    @JsonProperty("createTime")
685    public void writeCreateTime(Long newVal){
686        createTime = null == newVal?null:new java.util.Date(newVal);
687    }
688    /**
689     * Setter method for {@link #createTime}.<br>
690     * Convenient for those who do not want to deal with Objects for primary types.
691     *
692     * @param newVal the new value to be assigned to createTime
693     */
694    @JsonIgnore
695    public void setCreateTime(long newVal)
696    {
697        setCreateTime(new java.util.Date(newVal));
698    }
699    /**
700     * Setter method for {@link #createTime}.<br>
701     * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
702     */
703    @JsonIgnore
704    public void setCreateTime(Long newVal)
705    {
706        setCreateTime(null == newVal ? null : new java.util.Date(newVal));
707    }
708    /**
709     * Determines if the createTime has been modified.
710     *
711     * @return true if the field has been modified, false if the field has not been modified
712     */
713    public boolean checkCreateTimeModified()
714    {
715        return 0 !=  (modified & FD_IMAGE_ID_CREATE_TIME_MASK);
716    }
717
718    /**
719     * Determines if the createTime has been initialized.<br>
720     *
721     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
722     *
723     * @return true if the field has been initialized, false otherwise
724     */
725    public boolean checkCreateTimeInitialized()
726    {
727        return 0 !=  (initialized & FD_IMAGE_ID_CREATE_TIME_MASK);
728    }
729
730    @Override
731    public boolean beModified()
732    {
733        return 0 != modified;
734    }
735  
736    @Override
737    public boolean isModified(int columnID){
738        return columnID>=0 && columnID < metaData.columnCount && 0 !=  (modified & (1 << columnID));
739    }
740
741    @Override
742    public boolean isInitialized(int columnID){
743        return columnID>=0 && columnID < metaData.columnCount && 0 !=  (initialized & (1 << columnID));
744    }
745    
746    @Override
747    public void resetIsModified()
748    {
749        modified = 0;
750    }
751
752    @Override
753    public void resetPrimaryKeysModified()
754    {
755        modified &= (~(FD_IMAGE_ID_MD5_MASK));
756    }
757    /**
758     * Resets columns modification status except primary keys to 'not modified'.
759     */
760    public void resetModifiedExceptPrimaryKeys()
761    {
762        modified &= (~(FD_IMAGE_ID_FORMAT_MASK |
763            FD_IMAGE_ID_WIDTH_MASK |
764            FD_IMAGE_ID_HEIGHT_MASK |
765            FD_IMAGE_ID_DEPTH_MASK |
766            FD_IMAGE_ID_FACE_NUM_MASK |
767            FD_IMAGE_ID_UPDATE_TIME_MASK |
768            FD_IMAGE_ID_CREATE_TIME_MASK));
769    }
770
771    /** reset all fields to initial value, equal to a new bean */
772    public void reset(){
773        this.md5 = null;
774        this.format = null;
775        this.width = null;
776        this.height = null;
777        /* DEFAULT:'0'*/
778        this.depth = new Integer(0);
779        /* DEFAULT:'0'*/
780        this.faceNum = new Integer(0);
781        /* DEFAULT:'CURRENT_TIMESTAMP'*/
782        this.updateTime = null;
783        /* DEFAULT:'CURRENT_TIMESTAMP'*/
784        this.createTime = null;
785        this.isNew = true;
786        this.modified = 0;
787        this.initialized = (FD_IMAGE_ID_DEPTH_MASK | FD_IMAGE_ID_FACE_NUM_MASK);
788    }
789
790    @Override
791    public ImageBean clone(){
792        return (ImageBean) super.clone();
793    }
794
795
796    public static final Builder builder(){
797        return new Builder().reset();
798    }
799    /** 
800     * a builder for ImageBean,the template instance is thread local variable
801     * a instance of Builder can be reused.
802     */
803    public static final class Builder{
804        /** ImageBean instance used for template to create new ImageBean instance. */
805        static final ThreadLocal<ImageBean> TEMPLATE = new ThreadLocal<ImageBean>(){
806            @Override
807            protected ImageBean initialValue() {
808                return new ImageBean();
809            }};
810        private Builder() {}
811        /** 
812         * reset the bean as template 
813         * @see ImageBean#reset()
814         */
815        public Builder reset(){
816            TEMPLATE.get().reset();
817            return this;
818        }
819        /** set a bean as template,must not be {@code null} */
820        public Builder template(ImageBean bean){
821            if(null == bean){
822                throw new NullPointerException();
823            }
824            TEMPLATE.set(bean);
825            return this;
826        }
827        /** return a clone instance of {@link #TEMPLATE}*/
828        public ImageBean build(){
829            return TEMPLATE.get().clone();
830        }
831        /** 
832         * fill the field : fd_image.md5
833         * @param md5 主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key
834         * @see ImageBean#getMd5()
835         * @see ImageBean#setMd5(String)
836         */
837        public Builder md5(String md5){
838            TEMPLATE.get().setMd5(md5);
839            return this;
840        }
841        /** 
842         * fill the field : fd_image.format
843         * @param format 图像格式
844         * @see ImageBean#getFormat()
845         * @see ImageBean#setFormat(String)
846         */
847        public Builder format(String format){
848            TEMPLATE.get().setFormat(format);
849            return this;
850        }
851        /** 
852         * fill the field : fd_image.width
853         * @param width 图像宽度
854         * @see ImageBean#getWidth()
855         * @see ImageBean#setWidth(Integer)
856         */
857        public Builder width(Integer width){
858            TEMPLATE.get().setWidth(width);
859            return this;
860        }
861        /** 
862         * fill the field : fd_image.height
863         * @param height 图像高度
864         * @see ImageBean#getHeight()
865         * @see ImageBean#setHeight(Integer)
866         */
867        public Builder height(Integer height){
868            TEMPLATE.get().setHeight(height);
869            return this;
870        }
871        /** 
872         * fill the field : fd_image.depth
873         * @param depth 通道数
874         * @see ImageBean#getDepth()
875         * @see ImageBean#setDepth(Integer)
876         */
877        public Builder depth(Integer depth){
878            TEMPLATE.get().setDepth(depth);
879            return this;
880        }
881        /** 
882         * fill the field : fd_image.face_num
883         * @param faceNum 图像中的人脸数目
884         * @see ImageBean#getFaceNum()
885         * @see ImageBean#setFaceNum(Integer)
886         */
887        public Builder faceNum(Integer faceNum){
888            TEMPLATE.get().setFaceNum(faceNum);
889            return this;
890        }
891        /** 
892         * fill the field : fd_image.update_time
893         * @param updateTime 
894         * @see ImageBean#getUpdateTime()
895         * @see ImageBean#setUpdateTime(java.util.Date)
896         */
897        public Builder updateTime(java.util.Date updateTime){
898            TEMPLATE.get().setUpdateTime(updateTime);
899            return this;
900        }
901        /** 
902         * fill the field : fd_image.create_time
903         * @param createTime 
904         * @see ImageBean#getCreateTime()
905         * @see ImageBean#setCreateTime(java.util.Date)
906         */
907        public Builder createTime(java.util.Date createTime){
908            TEMPLATE.get().setCreateTime(createTime);
909            return this;
910        }
911    }
912}