001// ______________________________________________________
002// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 
003// modified by guyadong from
004// sql2java original version https://sourceforge.net/projects/sql2java/ 
005// JDBC driver used at code generation time: com.mysql.jdbc.Driver
006// template: bean.java.vm
007// ______________________________________________________
008package net.gdface.facelog.db;
009import java.io.Serializable;
010import java.util.List;
011import java.util.Objects;
012
013import com.facebook.swift.codec.ThriftStruct;
014import com.facebook.swift.codec.ThriftField;
015import com.facebook.swift.codec.ThriftField.Requiredness;
016import io.swagger.annotations.ApiModel;
017import io.swagger.annotations.ApiModelProperty;
018/**
019 * DeviceGroupBean is a mapping of fl_device_group Table.
020 * <br>Meta Data Information (in progress):
021 * <ul>
022 *    <li>comments: 设备组信息 </li>
023 * </ul>
024 * @author guyadong
025*/
026@ThriftStruct
027@ApiModel(description="设备组信息")
028public final class DeviceGroupBean
029    implements Serializable,BaseBean<DeviceGroupBean>,Comparable<DeviceGroupBean>,Constant,Cloneable
030{
031    private static final long serialVersionUID = 4625524271694791446L;
032    /** NULL {@link DeviceGroupBean} bean , IMMUTABLE instance */
033    public static final DeviceGroupBean NULL = new DeviceGroupBean().asNULL().asImmutable();
034    /** comments:设备组id */
035    @ApiModelProperty(value = "设备组id" ,required=true ,dataType="Integer")
036    private Integer id;
037
038    /** comments:设备组名 */
039    @ApiModelProperty(value = "设备组名" ,required=true ,dataType="String")
040    private String name;
041
042    /** comments:是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可 */
043    @ApiModelProperty(value = "是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可"  ,dataType="Integer")
044    private Integer leaf;
045
046    /** comments:上一级设备组id */
047    @ApiModelProperty(value = "上一级设备组id"  ,dataType="Integer")
048    private Integer parent;
049
050    /** comments:指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组 */
051    @ApiModelProperty(value = "指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组"  ,dataType="Integer")
052    private Integer rootGroup;
053
054    /** comments:设备工作时间表,为null或空为7x24小时工作,格式为JSON,参见开发手册 */
055    @ApiModelProperty(value = "设备工作时间表,为null或空为7x24小时工作,格式为JSON,参见开发手册"  ,dataType="String")
056    private String schedule;
057
058    /** comments:备注 */
059    @ApiModelProperty(value = "备注"  ,dataType="String")
060    private String remark;
061
062    /** comments:应用项目自定义二进制扩展字段(最大64KB) */
063    @ApiModelProperty(value = "应用项目自定义二进制扩展字段(最大64KB)"  ,dataType="ByteBuffer")
064    private java.nio.ByteBuffer extBin;
065
066    /** comments:应用项目自定义文本扩展字段(最大64KB) */
067    @ApiModelProperty(value = "应用项目自定义文本扩展字段(最大64KB)"  ,dataType="String")
068    private String extTxt;
069
070    @ApiModelProperty(value = "create_time"  ,dataType="Date")
071    private java.util.Date createTime;
072
073    @ApiModelProperty(value = "update_time"  ,dataType="Date")
074    private java.util.Date updateTime;
075
076    /** flag whether {@code this} can be modified */
077    private Boolean immutable;
078    /** columns modified flag */
079    @ApiModelProperty(value="columns modified flag",dataType="int",required=true)
080    private int modified;
081    /** columns initialized flag */
082    @ApiModelProperty(value="columns initialized flag",dataType="int",required=true)
083    private int initialized;
084    /** new record flag  */
085    @ApiModelProperty(value="new record flag",dataType="boolean",required=true)
086    private boolean isNew;        
087    /** 
088     * set immutable status
089     * @return {@code this} 
090     */
091    private DeviceGroupBean immutable(Boolean immutable) {
092        this.immutable = immutable;
093        return this;
094    }
095    /** 
096     * set {@code this} as immutable object
097     * @return {@code this} 
098     */
099    public DeviceGroupBean asImmutable() {
100        return immutable(Boolean.TRUE);
101    }
102    /**
103     * @return {@code true} if {@code this} is a mutable object  
104     */
105    public boolean mutable(){
106        return !Boolean.TRUE.equals(this.immutable);
107    }
108    /**
109     * @return {@code this}
110     * @throws IllegalStateException if {@code this} is a immutable object 
111     */
112    private DeviceGroupBean checkMutable(){
113        if(!mutable()){
114            throw new IllegalStateException("this is a immutable object");
115        }
116        return this;
117    }
118    /**
119     * @return return a new mutable copy of this object.
120     */
121    public DeviceGroupBean cloneMutable(){
122        return clone().immutable(null);
123    }
124    @ThriftField(value=1,name="_new",requiredness=Requiredness.REQUIRED)
125    @Override
126    public boolean isNew()
127    {
128        return this.isNew;
129    }
130
131
132    @Override
133    public void isNew(boolean isNew)
134    {
135        this.isNew = isNew;
136    }
137    /**
138     * Specifies to the object if it has been set as new.
139     *
140     * @param isNew the boolean value to be assigned to the isNew field
141     */
142    @ThriftField()
143    public void setNew(boolean isNew)
144    {
145        this.isNew = isNew;
146    }
147    /**
148     * @return the modified status of columns
149     */
150    @ThriftField(value=2,requiredness=Requiredness.REQUIRED)
151    public int getModified(){
152        return modified;
153    }
154
155    /**
156     * @param modified the modified status bit to be assigned to {@link #modified}
157     */
158    @ThriftField()
159    public void setModified(int modified){
160        this.modified = modified;
161    }
162    /**
163     * @return the initialized status of columns
164     */
165    @ThriftField(value=3,requiredness=Requiredness.REQUIRED)
166    public int getInitialized(){
167        return initialized;
168    }
169
170    /**
171     * @param initialized the initialized status bit to be assigned to {@link #initialized}
172     */
173    @ThriftField()
174    public void setInitialized(int initialized){
175        this.initialized = initialized;
176    }
177    protected static final <T extends Comparable<T>>boolean equals(T a, T b) {
178        return a == b || (a != null && 0==a.compareTo(b));
179    }
180    public DeviceGroupBean(){
181        super();
182        reset();
183    }
184    /**
185     * construct a new instance filled with primary keys
186     * @param id PK# 1 
187     */
188    public DeviceGroupBean(Integer id){
189        this();
190        setId(id);
191    }
192    /**
193     * Getter method for {@link #id}.<br>
194     * PRIMARY KEY.<br>
195     * Meta Data Information (in progress):
196     * <ul>
197     * <li>full name: fl_device_group.id</li>
198     * <li> imported key: fl_permit.device_group_id</li>
199     * <li> imported key: fl_device.group_id</li>
200     * <li> imported key: fl_device_group.parent</li>
201     * <li>comments: 设备组id</li>
202     * <li>AUTO_INCREMENT</li>
203     * <li>NOT NULL</li>
204     * <li>column size: 10</li>
205     * <li>JDBC type returned by the driver: Types.INTEGER</li>
206     * </ul>
207     *
208     * @return the value of id
209     */
210    @ThriftField(value=4)
211    public Integer getId(){
212        return id;
213    }
214    /**
215     * Setter method for {@link #id}.<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 id
221     */
222    public void setId(Integer newVal)
223    {
224        checkMutable();
225
226        modified |= FL_DEVICE_GROUP_ID_ID_MASK;
227        initialized |= FL_DEVICE_GROUP_ID_ID_MASK;
228
229        if (Objects.equals(newVal, id)) {
230            return;
231        }
232        id = newVal;
233    }
234    /** 
235     * setter for thrift:swift support<br>
236     * without modification for {@link #modified} and {@link #initialized}<br>
237     * <b>NOTE:</b>DO NOT use the method in your code
238     */
239    @ThriftField(name = "id")
240    public void writeId(Integer newVal){
241        checkMutable();
242        id = newVal;
243    }
244    /**
245     * Setter method for {@link #id}.<br>
246     * Convenient for those who do not want to deal with Objects for primary types.
247     *
248     * @param newVal the new value to be assigned to id
249     */
250    public void setId(int newVal)
251    {
252        setId(new Integer(newVal));
253    }
254    /**
255     * Determines if the id has been modified.
256     *
257     * @return true if the field has been modified, false if the field has not been modified
258     */
259    public boolean checkIdModified()
260    {
261        return 0L !=  (modified & FL_DEVICE_GROUP_ID_ID_MASK);
262    }
263
264    /**
265     * Determines if the id has been initialized.<br>
266     *
267     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
268     *
269     * @return true if the field has been initialized, false otherwise
270     */
271    public boolean checkIdInitialized()
272    {
273        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_ID_MASK);
274    }
275    /**
276     * Getter method for {@link #name}.<br>
277     * Meta Data Information (in progress):
278     * <ul>
279     * <li>full name: fl_device_group.name</li>
280     * <li>comments: 设备组名</li>
281     * <li>NOT NULL</li>
282     * <li>column size: 32</li>
283     * <li>JDBC type returned by the driver: Types.VARCHAR</li>
284     * </ul>
285     *
286     * @return the value of name
287     */
288    @ThriftField(value=5)
289    public String getName(){
290        return name;
291    }
292    /**
293     * Setter method for {@link #name}.<br>
294     * The new value is set only if equals() says it is different,
295     * or if one of either the new value or the current value is null.
296     * In case the new value is different, it is set and the field is marked as 'modified'.
297     *
298     * @param newVal the new value( NOT NULL) to be assigned to name
299     */
300    public void setName(String newVal)
301    {
302        checkMutable();
303
304        modified |= FL_DEVICE_GROUP_ID_NAME_MASK;
305        initialized |= FL_DEVICE_GROUP_ID_NAME_MASK;
306
307        if (Objects.equals(newVal, name)) {
308            return;
309        }
310        name = newVal;
311    }
312    /** 
313     * setter for thrift:swift support<br>
314     * without modification for {@link #modified} and {@link #initialized}<br>
315     * <b>NOTE:</b>DO NOT use the method in your code
316     */
317    @ThriftField(name = "name")
318    public void writeName(String newVal){
319        checkMutable();
320        name = newVal;
321    }
322    /**
323     * Determines if the name has been modified.
324     *
325     * @return true if the field has been modified, false if the field has not been modified
326     */
327    public boolean checkNameModified()
328    {
329        return 0L !=  (modified & FL_DEVICE_GROUP_ID_NAME_MASK);
330    }
331
332    /**
333     * Determines if the name has been initialized.<br>
334     *
335     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
336     *
337     * @return true if the field has been initialized, false otherwise
338     */
339    public boolean checkNameInitialized()
340    {
341        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_NAME_MASK);
342    }
343    /**
344     * Getter method for {@link #leaf}.<br>
345     * Meta Data Information (in progress):
346     * <ul>
347     * <li>full name: fl_device_group.leaf</li>
348     * <li>comments: 是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可</li>
349     * <li>column size: 3</li>
350     * <li>JDBC type returned by the driver: Types.TINYINT</li>
351     * </ul>
352     *
353     * @return the value of leaf
354     */
355    @ThriftField(value=6)
356    public Integer getLeaf(){
357        return leaf;
358    }
359    /**
360     * Setter method for {@link #leaf}.<br>
361     * The new value is set only if equals() says it is different,
362     * or if one of either the new value or the current value is null.
363     * In case the new value is different, it is set and the field is marked as 'modified'.
364     *
365     * @param newVal the new value to be assigned to leaf
366     */
367    public void setLeaf(Integer newVal)
368    {
369        checkMutable();
370
371        modified |= FL_DEVICE_GROUP_ID_LEAF_MASK;
372        initialized |= FL_DEVICE_GROUP_ID_LEAF_MASK;
373
374        if (Objects.equals(newVal, leaf)) {
375            return;
376        }
377        leaf = newVal;
378    }
379    /** 
380     * setter for thrift:swift support<br>
381     * without modification for {@link #modified} and {@link #initialized}<br>
382     * <b>NOTE:</b>DO NOT use the method in your code
383     */
384    @ThriftField(name = "leaf")
385    public void writeLeaf(Integer newVal){
386        checkMutable();
387        leaf = newVal;
388    }
389    /**
390     * Setter method for {@link #leaf}.<br>
391     * Convenient for those who do not want to deal with Objects for primary types.
392     *
393     * @param newVal the new value to be assigned to leaf
394     */
395    public void setLeaf(int newVal)
396    {
397        setLeaf(new Integer(newVal));
398    }
399    /**
400     * Determines if the leaf has been modified.
401     *
402     * @return true if the field has been modified, false if the field has not been modified
403     */
404    public boolean checkLeafModified()
405    {
406        return 0L !=  (modified & FL_DEVICE_GROUP_ID_LEAF_MASK);
407    }
408
409    /**
410     * Determines if the leaf has been initialized.<br>
411     *
412     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
413     *
414     * @return true if the field has been initialized, false otherwise
415     */
416    public boolean checkLeafInitialized()
417    {
418        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_LEAF_MASK);
419    }
420    /**
421     * Getter method for {@link #parent}.<br>
422     * Meta Data Information (in progress):
423     * <ul>
424     * <li>full name: fl_device_group.parent</li>
425     * <li> foreign key: fl_device_group.id</li>
426     * <li>comments: 上一级设备组id</li>
427     * <li>column size: 10</li>
428     * <li>JDBC type returned by the driver: Types.INTEGER</li>
429     * </ul>
430     *
431     * @return the value of parent
432     */
433    @ThriftField(value=7)
434    public Integer getParent(){
435        return parent;
436    }
437    /**
438     * Setter method for {@link #parent}.<br>
439     * The new value is set only if equals() says it is different,
440     * or if one of either the new value or the current value is null.
441     * In case the new value is different, it is set and the field is marked as 'modified'.
442     *
443     * @param newVal the new value to be assigned to parent
444     */
445    public void setParent(Integer newVal)
446    {
447        checkMutable();
448
449        modified |= FL_DEVICE_GROUP_ID_PARENT_MASK;
450        initialized |= FL_DEVICE_GROUP_ID_PARENT_MASK;
451
452        if (Objects.equals(newVal, parent)) {
453            return;
454        }
455        parent = newVal;
456    }
457    /** 
458     * setter for thrift:swift support<br>
459     * without modification for {@link #modified} and {@link #initialized}<br>
460     * <b>NOTE:</b>DO NOT use the method in your code
461     */
462    @ThriftField(name = "parent")
463    public void writeParent(Integer newVal){
464        checkMutable();
465        parent = newVal;
466    }
467    /**
468     * Setter method for {@link #parent}.<br>
469     * Convenient for those who do not want to deal with Objects for primary types.
470     *
471     * @param newVal the new value to be assigned to parent
472     */
473    public void setParent(int newVal)
474    {
475        setParent(new Integer(newVal));
476    }
477    /**
478     * Determines if the parent has been modified.
479     *
480     * @return true if the field has been modified, false if the field has not been modified
481     */
482    public boolean checkParentModified()
483    {
484        return 0L !=  (modified & FL_DEVICE_GROUP_ID_PARENT_MASK);
485    }
486
487    /**
488     * Determines if the parent has been initialized.<br>
489     *
490     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
491     *
492     * @return true if the field has been initialized, false otherwise
493     */
494    public boolean checkParentInitialized()
495    {
496        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_PARENT_MASK);
497    }
498    /**
499     * Getter method for {@link #rootGroup}.<br>
500     * Meta Data Information (in progress):
501     * <ul>
502     * <li>full name: fl_device_group.root_group</li>
503     * <li>comments: 指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组</li>
504     * <li>column size: 10</li>
505     * <li>JDBC type returned by the driver: Types.INTEGER</li>
506     * </ul>
507     *
508     * @return the value of rootGroup
509     */
510    @ThriftField(value=8)
511    public Integer getRootGroup(){
512        return rootGroup;
513    }
514    /**
515     * Setter method for {@link #rootGroup}.<br>
516     * The new value is set only if equals() says it is different,
517     * or if one of either the new value or the current value is null.
518     * In case the new value is different, it is set and the field is marked as 'modified'.
519     *
520     * @param newVal the new value to be assigned to rootGroup
521     */
522    public void setRootGroup(Integer newVal)
523    {
524        checkMutable();
525
526        modified |= FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK;
527        initialized |= FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK;
528
529        if (Objects.equals(newVal, rootGroup)) {
530            return;
531        }
532        rootGroup = newVal;
533    }
534    /** 
535     * setter for thrift:swift support<br>
536     * without modification for {@link #modified} and {@link #initialized}<br>
537     * <b>NOTE:</b>DO NOT use the method in your code
538     */
539    @ThriftField(name = "rootGroup")
540    public void writeRootGroup(Integer newVal){
541        checkMutable();
542        rootGroup = newVal;
543    }
544    /**
545     * Setter method for {@link #rootGroup}.<br>
546     * Convenient for those who do not want to deal with Objects for primary types.
547     *
548     * @param newVal the new value to be assigned to rootGroup
549     */
550    public void setRootGroup(int newVal)
551    {
552        setRootGroup(new Integer(newVal));
553    }
554    /**
555     * Determines if the rootGroup has been modified.
556     *
557     * @return true if the field has been modified, false if the field has not been modified
558     */
559    public boolean checkRootGroupModified()
560    {
561        return 0L !=  (modified & FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK);
562    }
563
564    /**
565     * Determines if the rootGroup has been initialized.<br>
566     *
567     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
568     *
569     * @return true if the field has been initialized, false otherwise
570     */
571    public boolean checkRootGroupInitialized()
572    {
573        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK);
574    }
575    /**
576     * Getter method for {@link #schedule}.<br>
577     * Meta Data Information (in progress):
578     * <ul>
579     * <li>full name: fl_device_group.schedule</li>
580     * <li>comments: 设备工作时间表,为null或空为7x24小时工作,格式为JSON,参见开发手册</li>
581     * <li>column size: 4096</li>
582     * <li>JDBC type returned by the driver: Types.VARCHAR</li>
583     * </ul>
584     *
585     * @return the value of schedule
586     */
587    @ThriftField(value=9)
588    public String getSchedule(){
589        return schedule;
590    }
591    /**
592     * Setter method for {@link #schedule}.<br>
593     * The new value is set only if equals() says it is different,
594     * or if one of either the new value or the current value is null.
595     * In case the new value is different, it is set and the field is marked as 'modified'.
596     *
597     * @param newVal the new value to be assigned to schedule
598     */
599    public void setSchedule(String newVal)
600    {
601        checkMutable();
602
603        modified |= FL_DEVICE_GROUP_ID_SCHEDULE_MASK;
604        initialized |= FL_DEVICE_GROUP_ID_SCHEDULE_MASK;
605
606        if (Objects.equals(newVal, schedule)) {
607            return;
608        }
609        schedule = newVal;
610    }
611    /** 
612     * setter for thrift:swift support<br>
613     * without modification for {@link #modified} and {@link #initialized}<br>
614     * <b>NOTE:</b>DO NOT use the method in your code
615     */
616    @ThriftField(name = "schedule")
617    public void writeSchedule(String newVal){
618        checkMutable();
619        schedule = newVal;
620    }
621    /**
622     * Determines if the schedule has been modified.
623     *
624     * @return true if the field has been modified, false if the field has not been modified
625     */
626    public boolean checkScheduleModified()
627    {
628        return 0L !=  (modified & FL_DEVICE_GROUP_ID_SCHEDULE_MASK);
629    }
630
631    /**
632     * Determines if the schedule has been initialized.<br>
633     *
634     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
635     *
636     * @return true if the field has been initialized, false otherwise
637     */
638    public boolean checkScheduleInitialized()
639    {
640        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_SCHEDULE_MASK);
641    }
642    /**
643     * Getter method for {@link #remark}.<br>
644     * Meta Data Information (in progress):
645     * <ul>
646     * <li>full name: fl_device_group.remark</li>
647     * <li>comments: 备注</li>
648     * <li>column size: 256</li>
649     * <li>JDBC type returned by the driver: Types.VARCHAR</li>
650     * </ul>
651     *
652     * @return the value of remark
653     */
654    @ThriftField(value=10)
655    public String getRemark(){
656        return remark;
657    }
658    /**
659     * Setter method for {@link #remark}.<br>
660     * The new value is set only if equals() says it is different,
661     * or if one of either the new value or the current value is null.
662     * In case the new value is different, it is set and the field is marked as 'modified'.
663     *
664     * @param newVal the new value to be assigned to remark
665     */
666    public void setRemark(String newVal)
667    {
668        checkMutable();
669
670        modified |= FL_DEVICE_GROUP_ID_REMARK_MASK;
671        initialized |= FL_DEVICE_GROUP_ID_REMARK_MASK;
672
673        if (Objects.equals(newVal, remark)) {
674            return;
675        }
676        remark = newVal;
677    }
678    /** 
679     * setter for thrift:swift 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 = "remark")
684    public void writeRemark(String newVal){
685        checkMutable();
686        remark = newVal;
687    }
688    /**
689     * Determines if the remark has been modified.
690     *
691     * @return true if the field has been modified, false if the field has not been modified
692     */
693    public boolean checkRemarkModified()
694    {
695        return 0L !=  (modified & FL_DEVICE_GROUP_ID_REMARK_MASK);
696    }
697
698    /**
699     * Determines if the remark has been initialized.<br>
700     *
701     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
702     *
703     * @return true if the field has been initialized, false otherwise
704     */
705    public boolean checkRemarkInitialized()
706    {
707        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_REMARK_MASK);
708    }
709    /**
710     * Getter method for {@link #extBin}.<br>
711     * Meta Data Information (in progress):
712     * <ul>
713     * <li>full name: fl_device_group.ext_bin</li>
714     * <li>comments: 应用项目自定义二进制扩展字段(最大64KB)</li>
715     * <li>column size: 65535</li>
716     * <li>JDBC type returned by the driver: Types.LONGVARBINARY</li>
717     * </ul>
718     *
719     * @return the value of extBin
720     */
721    @ThriftField(value=11)
722    public java.nio.ByteBuffer getExtBin(){
723        return extBin;
724    }
725    /**
726     * Setter method for {@link #extBin}.<br>
727     * The new value is set only if equals() says it is different,
728     * or if one of either the new value or the current value is null.
729     * In case the new value is different, it is set and the field is marked as 'modified'.
730     *
731     * @param newVal the new value to be assigned to extBin
732     */
733    public void setExtBin(java.nio.ByteBuffer newVal)
734    {
735        checkMutable();
736
737        modified |= FL_DEVICE_GROUP_ID_EXT_BIN_MASK;
738        initialized |= FL_DEVICE_GROUP_ID_EXT_BIN_MASK;
739
740        if (Objects.equals(newVal, extBin)) {
741            return;
742        }
743        extBin = newVal;
744    }
745    /** 
746     * setter for thrift:swift support<br>
747     * without modification for {@link #modified} and {@link #initialized}<br>
748     * <b>NOTE:</b>DO NOT use the method in your code
749     */
750    @ThriftField(name = "extBin")
751    public void writeExtBin(java.nio.ByteBuffer newVal){
752        checkMutable();
753        extBin = newVal;
754    }
755    /**
756     * Determines if the extBin has been modified.
757     *
758     * @return true if the field has been modified, false if the field has not been modified
759     */
760    public boolean checkExtBinModified()
761    {
762        return 0L !=  (modified & FL_DEVICE_GROUP_ID_EXT_BIN_MASK);
763    }
764
765    /**
766     * Determines if the extBin has been initialized.<br>
767     *
768     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
769     *
770     * @return true if the field has been initialized, false otherwise
771     */
772    public boolean checkExtBinInitialized()
773    {
774        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_EXT_BIN_MASK);
775    }
776    /**
777     * Getter method for {@link #extTxt}.<br>
778     * Meta Data Information (in progress):
779     * <ul>
780     * <li>full name: fl_device_group.ext_txt</li>
781     * <li>comments: 应用项目自定义文本扩展字段(最大64KB)</li>
782     * <li>column size: 65535</li>
783     * <li>JDBC type returned by the driver: Types.LONGVARCHAR</li>
784     * </ul>
785     *
786     * @return the value of extTxt
787     */
788    @ThriftField(value=12)
789    public String getExtTxt(){
790        return extTxt;
791    }
792    /**
793     * Setter method for {@link #extTxt}.<br>
794     * The new value is set only if equals() says it is different,
795     * or if one of either the new value or the current value is null.
796     * In case the new value is different, it is set and the field is marked as 'modified'.
797     *
798     * @param newVal the new value to be assigned to extTxt
799     */
800    public void setExtTxt(String newVal)
801    {
802        checkMutable();
803
804        modified |= FL_DEVICE_GROUP_ID_EXT_TXT_MASK;
805        initialized |= FL_DEVICE_GROUP_ID_EXT_TXT_MASK;
806
807        if (Objects.equals(newVal, extTxt)) {
808            return;
809        }
810        extTxt = newVal;
811    }
812    /** 
813     * setter for thrift:swift support<br>
814     * without modification for {@link #modified} and {@link #initialized}<br>
815     * <b>NOTE:</b>DO NOT use the method in your code
816     */
817    @ThriftField(name = "extTxt")
818    public void writeExtTxt(String newVal){
819        checkMutable();
820        extTxt = newVal;
821    }
822    /**
823     * Determines if the extTxt has been modified.
824     *
825     * @return true if the field has been modified, false if the field has not been modified
826     */
827    public boolean checkExtTxtModified()
828    {
829        return 0L !=  (modified & FL_DEVICE_GROUP_ID_EXT_TXT_MASK);
830    }
831
832    /**
833     * Determines if the extTxt has been initialized.<br>
834     *
835     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
836     *
837     * @return true if the field has been initialized, false otherwise
838     */
839    public boolean checkExtTxtInitialized()
840    {
841        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_EXT_TXT_MASK);
842    }
843    /**
844     * Getter method for {@link #createTime}.<br>
845     * Meta Data Information (in progress):
846     * <ul>
847     * <li>full name: fl_device_group.create_time</li>
848     * <li>default value: 'CURRENT_TIMESTAMP'</li>
849     * <li>NOT NULL</li>
850     * <li>column size: 19</li>
851     * <li>JDBC type returned by the driver: Types.TIMESTAMP</li>
852     * </ul>
853     *
854     * @return the value of createTime
855     */
856    public java.util.Date getCreateTime(){
857        return createTime;
858    }
859    /** 
860     * use Long to represent date type for thrift:swift support 
861     * @see #getCreateTime()
862     */
863    @ThriftField(name = "createTime",value = 13)
864    public Long readCreateTime(){
865        return null == createTime ? null:createTime.getTime();
866    }
867    /**
868     * Setter method for {@link #createTime}.<br>
869     * The new value is set only if equals() says it is different,
870     * or if one of either the new value or the current value is null.
871     * In case the new value is different, it is set and the field is marked as 'modified'.
872     *
873     * @param newVal the new value( NOT NULL) to be assigned to createTime
874     */
875    public void setCreateTime(java.util.Date newVal)
876    {
877        checkMutable();
878
879        modified |= FL_DEVICE_GROUP_ID_CREATE_TIME_MASK;
880        initialized |= FL_DEVICE_GROUP_ID_CREATE_TIME_MASK;
881
882        if (Objects.equals(newVal, createTime)) {
883            return;
884        }
885        createTime = newVal;
886    }
887    /** 
888     * setter for thrift:swift support<br>
889     * without modification for {@link #modified} and {@link #initialized}<br>
890     * <b>NOTE:</b>DO NOT use the method in your code
891     */
892    @ThriftField(name = "createTime")
893    public void writeCreateTime(Long newVal){
894        checkMutable();
895        createTime = null == newVal?null:new java.util.Date(newVal);
896    }
897    /**
898     * Setter method for {@link #createTime}.<br>
899     * Convenient for those who do not want to deal with Objects for primary types.
900     *
901     * @param newVal the new value to be assigned to createTime
902     */
903    public void setCreateTime(long newVal)
904    {
905        setCreateTime(new java.util.Date(newVal));
906    }
907    /**
908     * Setter method for {@link #createTime}.<br>
909     * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
910     */
911    public void setCreateTime(Long newVal)
912    {
913        setCreateTime(null == newVal ? null : new java.util.Date(newVal));
914    }
915    /**
916     * Determines if the createTime has been modified.
917     *
918     * @return true if the field has been modified, false if the field has not been modified
919     */
920    public boolean checkCreateTimeModified()
921    {
922        return 0L !=  (modified & FL_DEVICE_GROUP_ID_CREATE_TIME_MASK);
923    }
924
925    /**
926     * Determines if the createTime has been initialized.<br>
927     *
928     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
929     *
930     * @return true if the field has been initialized, false otherwise
931     */
932    public boolean checkCreateTimeInitialized()
933    {
934        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_CREATE_TIME_MASK);
935    }
936    /**
937     * Getter method for {@link #updateTime}.<br>
938     * Meta Data Information (in progress):
939     * <ul>
940     * <li>full name: fl_device_group.update_time</li>
941     * <li>default value: 'CURRENT_TIMESTAMP'</li>
942     * <li>NOT NULL</li>
943     * <li>column size: 19</li>
944     * <li>JDBC type returned by the driver: Types.TIMESTAMP</li>
945     * </ul>
946     *
947     * @return the value of updateTime
948     */
949    public java.util.Date getUpdateTime(){
950        return updateTime;
951    }
952    /** 
953     * use Long to represent date type for thrift:swift support 
954     * @see #getUpdateTime()
955     */
956    @ThriftField(name = "updateTime",value = 14)
957    public Long readUpdateTime(){
958        return null == updateTime ? null:updateTime.getTime();
959    }
960    /**
961     * Setter method for {@link #updateTime}.<br>
962     * The new value is set only if equals() says it is different,
963     * or if one of either the new value or the current value is null.
964     * In case the new value is different, it is set and the field is marked as 'modified'.
965     *
966     * @param newVal the new value( NOT NULL) to be assigned to updateTime
967     */
968    public void setUpdateTime(java.util.Date newVal)
969    {
970        checkMutable();
971
972        modified |= FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK;
973        initialized |= FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK;
974
975        if (Objects.equals(newVal, updateTime)) {
976            return;
977        }
978        updateTime = newVal;
979    }
980    /** 
981     * setter for thrift:swift support<br>
982     * without modification for {@link #modified} and {@link #initialized}<br>
983     * <b>NOTE:</b>DO NOT use the method in your code
984     */
985    @ThriftField(name = "updateTime")
986    public void writeUpdateTime(Long newVal){
987        checkMutable();
988        updateTime = null == newVal?null:new java.util.Date(newVal);
989    }
990    /**
991     * Setter method for {@link #updateTime}.<br>
992     * Convenient for those who do not want to deal with Objects for primary types.
993     *
994     * @param newVal the new value to be assigned to updateTime
995     */
996    public void setUpdateTime(long newVal)
997    {
998        setUpdateTime(new java.util.Date(newVal));
999    }
1000    /**
1001     * Setter method for {@link #updateTime}.<br>
1002     * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
1003     */
1004    public void setUpdateTime(Long newVal)
1005    {
1006        setUpdateTime(null == newVal ? null : new java.util.Date(newVal));
1007    }
1008    /**
1009     * Determines if the updateTime has been modified.
1010     *
1011     * @return true if the field has been modified, false if the field has not been modified
1012     */
1013    public boolean checkUpdateTimeModified()
1014    {
1015        return 0L !=  (modified & FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK);
1016    }
1017
1018    /**
1019     * Determines if the updateTime has been initialized.<br>
1020     *
1021     * It is useful to determine if a field is null on purpose or just because it has not been initialized.
1022     *
1023     * @return true if the field has been initialized, false otherwise
1024     */
1025    public boolean checkUpdateTimeInitialized()
1026    {
1027        return 0L !=  (initialized & FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK);
1028    }
1029    //////////////////////////////////////
1030    // referenced bean for FOREIGN KEYS
1031    //////////////////////////////////////
1032    /** 
1033     * The referenced {@link DeviceGroupBean} by {@link #parent} . <br>
1034     * FOREIGN KEY (parent) REFERENCES fl_device_group(id)
1035     */
1036    @ApiModelProperty(hidden = true)
1037    private DeviceGroupBean referencedByParent;
1038    /**
1039     * Getter method for {@link #referencedByParent}.
1040     * @return DeviceGroupBean
1041     */
1042    public DeviceGroupBean getReferencedByParent() {
1043        return this.referencedByParent;
1044    }
1045    /**
1046     * Setter method for {@link #referencedByParent}.
1047     * @param reference DeviceGroupBean
1048     */
1049    public void setReferencedByParent(DeviceGroupBean reference) {
1050        this.referencedByParent = reference;
1051    }
1052
1053    @Override
1054    public boolean isModified()
1055    {
1056        return 0 != modified;
1057    }
1058  
1059    @Override
1060    public boolean isModified(int columnID){
1061        switch ( columnID ){
1062        case FL_DEVICE_GROUP_ID_ID:
1063            return checkIdModified();
1064        case FL_DEVICE_GROUP_ID_NAME:
1065            return checkNameModified();
1066        case FL_DEVICE_GROUP_ID_LEAF:
1067            return checkLeafModified();
1068        case FL_DEVICE_GROUP_ID_PARENT:
1069            return checkParentModified();
1070        case FL_DEVICE_GROUP_ID_ROOT_GROUP:
1071            return checkRootGroupModified();
1072        case FL_DEVICE_GROUP_ID_SCHEDULE:
1073            return checkScheduleModified();
1074        case FL_DEVICE_GROUP_ID_REMARK:
1075            return checkRemarkModified();
1076        case FL_DEVICE_GROUP_ID_EXT_BIN:
1077            return checkExtBinModified();
1078        case FL_DEVICE_GROUP_ID_EXT_TXT:
1079            return checkExtTxtModified();
1080        case FL_DEVICE_GROUP_ID_CREATE_TIME:
1081            return checkCreateTimeModified();
1082        case FL_DEVICE_GROUP_ID_UPDATE_TIME:
1083            return checkUpdateTimeModified();
1084        default:
1085            return false;
1086        }        
1087    }
1088
1089    @Override
1090    public boolean isInitialized(int columnID){
1091        switch(columnID) {
1092        case FL_DEVICE_GROUP_ID_ID:
1093            return checkIdInitialized();
1094        case FL_DEVICE_GROUP_ID_NAME:
1095            return checkNameInitialized();
1096        case FL_DEVICE_GROUP_ID_LEAF:
1097            return checkLeafInitialized();
1098        case FL_DEVICE_GROUP_ID_PARENT:
1099            return checkParentInitialized();
1100        case FL_DEVICE_GROUP_ID_ROOT_GROUP:
1101            return checkRootGroupInitialized();
1102        case FL_DEVICE_GROUP_ID_SCHEDULE:
1103            return checkScheduleInitialized();
1104        case FL_DEVICE_GROUP_ID_REMARK:
1105            return checkRemarkInitialized();
1106        case FL_DEVICE_GROUP_ID_EXT_BIN:
1107            return checkExtBinInitialized();
1108        case FL_DEVICE_GROUP_ID_EXT_TXT:
1109            return checkExtTxtInitialized();
1110        case FL_DEVICE_GROUP_ID_CREATE_TIME:
1111            return checkCreateTimeInitialized();
1112        case FL_DEVICE_GROUP_ID_UPDATE_TIME:
1113            return checkUpdateTimeInitialized();
1114        default:
1115            return false;
1116        }
1117    }
1118    
1119    @Override
1120    public boolean isModified(String column){        
1121        return isModified(columnIDOf(column));
1122    }
1123
1124    @Override
1125    public boolean isInitialized(String column){
1126        return isInitialized(columnIDOf(column));
1127    }
1128    
1129    @Override
1130    public void resetIsModified()
1131    {
1132        checkMutable();
1133        modified = 0;
1134    }
1135
1136    @Override
1137    public void resetPrimaryKeysModified()
1138    {
1139        modified &= (~(FL_DEVICE_GROUP_ID_ID_MASK));
1140    }
1141    /**
1142     * Resets columns modification status except primary keys to 'not modified'.
1143     */
1144    public void resetModifiedExceptPrimaryKeys()
1145    {
1146        modified &= (~(FL_DEVICE_GROUP_ID_NAME_MASK |
1147            FL_DEVICE_GROUP_ID_LEAF_MASK |
1148            FL_DEVICE_GROUP_ID_PARENT_MASK |
1149            FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK |
1150            FL_DEVICE_GROUP_ID_SCHEDULE_MASK |
1151            FL_DEVICE_GROUP_ID_REMARK_MASK |
1152            FL_DEVICE_GROUP_ID_EXT_BIN_MASK |
1153            FL_DEVICE_GROUP_ID_EXT_TXT_MASK |
1154            FL_DEVICE_GROUP_ID_CREATE_TIME_MASK |
1155            FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK));
1156    }
1157    /**
1158     * Resets the object initialization status to 'not initialized'.
1159     */
1160    private void resetInitialized()
1161    {
1162        initialized = 0;
1163    }
1164    /** reset all fields to initial value, equal to a new bean */
1165    public void reset(){
1166        checkMutable();
1167        this.id = null;
1168        this.name = null;
1169        this.leaf = null;
1170        this.parent = null;
1171        this.rootGroup = null;
1172        this.schedule = null;
1173        this.remark = null;
1174        this.extBin = null;
1175        this.extTxt = null;
1176        /* DEFAULT:'CURRENT_TIMESTAMP'*/
1177        this.createTime = null;
1178        /* DEFAULT:'CURRENT_TIMESTAMP'*/
1179        this.updateTime = null;
1180        this.isNew = true;
1181        this.modified = 0;
1182        this.initialized = 0;
1183    }
1184    @Override
1185    public boolean equals(Object object)
1186    {
1187        if (!(object instanceof DeviceGroupBean)) {
1188            return false;
1189        }
1190
1191        DeviceGroupBean obj = (DeviceGroupBean) object;
1192        return new EqualsBuilder()
1193            .append(getId(), obj.getId())
1194            .append(getName(), obj.getName())
1195            .append(getLeaf(), obj.getLeaf())
1196            .append(getParent(), obj.getParent())
1197            .append(getRootGroup(), obj.getRootGroup())
1198            .append(getSchedule(), obj.getSchedule())
1199            .append(getRemark(), obj.getRemark())
1200            .append(getExtBin(), obj.getExtBin())
1201            .append(getExtTxt(), obj.getExtTxt())
1202            .append(getCreateTime(), obj.getCreateTime())
1203            .append(getUpdateTime(), obj.getUpdateTime())
1204            .isEquals();
1205    }
1206
1207    @Override
1208    public int hashCode()
1209    {
1210        return new HashCodeBuilder(-82280557, -700257973)
1211            .append(getId())
1212            .toHashCode();
1213    }
1214
1215    @Override
1216    public String toString() {
1217        return toString(true,false);
1218    }
1219    /**
1220     * cast byte array to HEX string
1221     * 
1222     * @param input
1223     * @return {@code null} if {@code input} is null
1224     */
1225    private static final String toHex(byte[] input) {
1226        if (null == input){
1227            return null;
1228        }
1229        StringBuffer sb = new StringBuffer(input.length * 2);
1230        for (int i = 0; i < input.length; i++) {
1231            sb.append(Character.forDigit((input[i] & 240) >> 4, 16));
1232            sb.append(Character.forDigit(input[i] & 15, 16));
1233        }
1234        return sb.toString();
1235    }
1236    protected static final StringBuilder append(StringBuilder buffer,boolean full,byte[] value){
1237        if(full || null == value){
1238            buffer.append(toHex(value));
1239        }else{
1240            buffer.append(value.length).append(" bytes");
1241        }
1242        return buffer;
1243    }
1244    private static int stringLimit = 64;
1245    private static final int MINIMUM_LIMIT = 16;
1246    protected static final StringBuilder append(StringBuilder buffer,boolean full,String value){
1247        if(full || null == value || value.length() <= stringLimit){
1248            buffer.append(value);
1249        }else{
1250            buffer.append(value.substring(0,stringLimit - 8)).append(" ...").append(value.substring(stringLimit-4,stringLimit));
1251        }
1252        return buffer;
1253    }
1254    protected static final <T>StringBuilder append(StringBuilder buffer,boolean full,T value){
1255        return buffer.append(value);
1256    }
1257    public static final void setStringLimit(int limit){
1258        if(limit < MINIMUM_LIMIT){
1259            throw new IllegalArgumentException(String.format("INVALID limit %d,minimum value %d",limit,MINIMUM_LIMIT));
1260        }
1261        stringLimit = limit;
1262    }
1263    @Override
1264    public String toString(boolean notNull, boolean fullIfStringOrBytes) {
1265        // only output initialized field
1266        StringBuilder builder = new StringBuilder(this.getClass().getName()).append("@").append(Integer.toHexString(this.hashCode())).append("[");
1267        int count = 0;        
1268        if(checkIdInitialized()){
1269            if(!notNull || null != getId()){
1270                if(count++ >0){
1271                    builder.append(",");
1272                }
1273                builder.append("id=");
1274                append(builder,fullIfStringOrBytes,getId());
1275            }
1276        }
1277        if(checkNameInitialized()){
1278            if(!notNull || null != getName()){
1279                if(count++ >0){
1280                    builder.append(",");
1281                }
1282                builder.append("name=");
1283                append(builder,fullIfStringOrBytes,getName());
1284            }
1285        }
1286        if(checkLeafInitialized()){
1287            if(!notNull || null != getLeaf()){
1288                if(count++ >0){
1289                    builder.append(",");
1290                }
1291                builder.append("leaf=");
1292                append(builder,fullIfStringOrBytes,getLeaf());
1293            }
1294        }
1295        if(checkParentInitialized()){
1296            if(!notNull || null != getParent()){
1297                if(count++ >0){
1298                    builder.append(",");
1299                }
1300                builder.append("parent=");
1301                append(builder,fullIfStringOrBytes,getParent());
1302            }
1303        }
1304        if(checkRootGroupInitialized()){
1305            if(!notNull || null != getRootGroup()){
1306                if(count++ >0){
1307                    builder.append(",");
1308                }
1309                builder.append("root_group=");
1310                append(builder,fullIfStringOrBytes,getRootGroup());
1311            }
1312        }
1313        if(checkScheduleInitialized()){
1314            if(!notNull || null != getSchedule()){
1315                if(count++ >0){
1316                    builder.append(",");
1317                }
1318                builder.append("schedule=");
1319                append(builder,fullIfStringOrBytes,getSchedule());
1320            }
1321        }
1322        if(checkRemarkInitialized()){
1323            if(!notNull || null != getRemark()){
1324                if(count++ >0){
1325                    builder.append(",");
1326                }
1327                builder.append("remark=");
1328                append(builder,fullIfStringOrBytes,getRemark());
1329            }
1330        }
1331        if(checkExtBinInitialized()){
1332            if(!notNull || null != getExtBin()){
1333                if(count++ >0){
1334                    builder.append(",");
1335                }
1336                builder.append("ext_bin=");
1337                append(builder,fullIfStringOrBytes,getExtBin());
1338            }
1339        }
1340        if(checkExtTxtInitialized()){
1341            if(!notNull || null != getExtTxt()){
1342                if(count++ >0){
1343                    builder.append(",");
1344                }
1345                builder.append("ext_txt=");
1346                append(builder,fullIfStringOrBytes,getExtTxt());
1347            }
1348        }
1349        if(checkCreateTimeInitialized()){
1350            if(!notNull || null != getCreateTime()){
1351                if(count++ >0){
1352                    builder.append(",");
1353                }
1354                builder.append("create_time=");
1355                append(builder,fullIfStringOrBytes,getCreateTime());
1356            }
1357        }
1358        if(checkUpdateTimeInitialized()){
1359            if(!notNull || null != getUpdateTime()){
1360                if(count++ >0){
1361                    builder.append(",");
1362                }
1363                builder.append("update_time=");
1364                append(builder,fullIfStringOrBytes,getUpdateTime());
1365            }
1366        }
1367        builder.append("]");
1368        return builder.toString();
1369    }
1370    @Override
1371    public int compareTo(DeviceGroupBean object){
1372        return new CompareToBuilder()
1373            .append(getId(), object.getId())
1374            .append(getName(), object.getName())
1375            .append(getLeaf(), object.getLeaf())
1376            .append(getParent(), object.getParent())
1377            .append(getRootGroup(), object.getRootGroup())
1378            .append(getSchedule(), object.getSchedule())
1379            .append(getRemark(), object.getRemark())
1380            .append(getExtBin(), object.getExtBin())
1381            .append(getExtTxt(), object.getExtTxt())
1382            .append(getCreateTime(), object.getCreateTime())
1383            .append(getUpdateTime(), object.getUpdateTime())
1384            .toComparison();
1385    }
1386    @Override
1387    public DeviceGroupBean clone(){
1388        try {
1389            return (DeviceGroupBean) super.clone();
1390        } catch (CloneNotSupportedException e) {
1391            throw new RuntimeException(e);
1392        }
1393    }
1394    /**
1395     * Make {@code this} to a NULL bean<br>
1396     * set all fields to null, {@link #modified} and {@link #initialized} be set to 0
1397     * @return {@code this} bean
1398     * @author guyadong
1399     */
1400    public DeviceGroupBean asNULL()
1401    {   
1402        checkMutable();
1403        
1404        setId((Integer)null);
1405        setName((String)null);
1406        setLeaf((Integer)null);
1407        setParent((Integer)null);
1408        setRootGroup((Integer)null);
1409        setSchedule((String)null);
1410        setRemark((String)null);
1411        setExtBin((java.nio.ByteBuffer)null);
1412        setExtTxt((String)null);
1413        setCreateTime((java.util.Date)null);
1414        setUpdateTime((java.util.Date)null);
1415        isNew(true);
1416        resetInitialized();
1417        resetIsModified();
1418        return this;
1419    }
1420    /**
1421     * check whether this bean is a NULL bean 
1422     * @return {@code true} if {@link #initialized} be set to zero
1423     * @see #asNULL()
1424     */
1425    public boolean checkNULL(){
1426        return 0 == getInitialized();
1427    }
1428    /** 
1429     * @param source source list
1430     * @return {@code source} replace {@code null} element with null instance({@link #NULL})
1431     */
1432    public static final List<DeviceGroupBean> replaceNull(List<DeviceGroupBean> source){
1433        if(null != source){
1434            for(int i = 0,endIndex = source.size();i<endIndex;++i){
1435                if(null == source.get(i)){
1436                    source.set(i, NULL);
1437                }
1438            }
1439        }
1440        return source;
1441    }
1442    /** 
1443     * @param source input list
1444     * @return replace null instance element with {@code null}
1445     * @see #checkNULL()
1446     */
1447    public static final List<DeviceGroupBean> replaceNullInstance(List<DeviceGroupBean> source){
1448        if(null != source){
1449            for(int i = 0,endIndex = source.size();i<endIndex;++i){
1450                if(source.get(i).checkNULL()){
1451                    source.set(i, null);
1452                }
1453            }
1454        }
1455        return source;
1456    }
1457    @Override
1458    public DeviceGroupBean copy(DeviceGroupBean bean)
1459    {
1460        return copy(bean,new int[]{});
1461    }
1462    @Override
1463    public DeviceGroupBean copy(DeviceGroupBean bean, int... fieldList)
1464    {
1465        if (null == fieldList || 0 == fieldList.length){
1466            fieldList = new int[]{0,1,2,3,4,5,6,7,8,9,10};
1467        }
1468        for (int i = 0; i < fieldList.length; ++i) {
1469            if( bean.isInitialized(fieldList[i]) && !Objects.deepEquals(bean.getValue(fieldList[i]), getValue(fieldList[i]))){
1470                setValue(fieldList[i], bean.getValue(fieldList[i]));
1471            }
1472        }
1473        return this;
1474    }
1475        
1476    @Override
1477    public DeviceGroupBean copy(DeviceGroupBean bean, String... fieldList)
1478    {
1479        if (null == fieldList || 0 == fieldList.length){
1480            copy(bean,(int[])null);
1481        }else{
1482            int field;
1483            for (int i = 0; i < fieldList.length; i++) {
1484                field = columnIDOf(fieldList[i].trim());
1485                if(bean.isInitialized(field) && !Objects.deepEquals(bean.getValue(field), getValue(field))){
1486                    setValue(field, bean.getValue(field));
1487                }
1488            }
1489        }
1490        return this;
1491    }
1492
1493    @SuppressWarnings("unchecked")
1494    @Override
1495    public <T>T getValue(int columnID)
1496    {
1497        switch( columnID ){
1498        case FL_DEVICE_GROUP_ID_ID: 
1499            return (T)getId();        
1500        case FL_DEVICE_GROUP_ID_NAME: 
1501            return (T)getName();        
1502        case FL_DEVICE_GROUP_ID_LEAF: 
1503            return (T)getLeaf();        
1504        case FL_DEVICE_GROUP_ID_PARENT: 
1505            return (T)getParent();        
1506        case FL_DEVICE_GROUP_ID_ROOT_GROUP: 
1507            return (T)getRootGroup();        
1508        case FL_DEVICE_GROUP_ID_SCHEDULE: 
1509            return (T)getSchedule();        
1510        case FL_DEVICE_GROUP_ID_REMARK: 
1511            return (T)getRemark();        
1512        case FL_DEVICE_GROUP_ID_EXT_BIN: 
1513            return (T)getExtBin();        
1514        case FL_DEVICE_GROUP_ID_EXT_TXT: 
1515            return (T)getExtTxt();        
1516        case FL_DEVICE_GROUP_ID_CREATE_TIME: 
1517            return (T)getCreateTime();        
1518        case FL_DEVICE_GROUP_ID_UPDATE_TIME: 
1519            return (T)getUpdateTime();        
1520        default:
1521            return null;
1522        }
1523    }
1524
1525    @Override
1526    public <T> void setValue(int columnID,T value)
1527    {
1528        switch( columnID ) {
1529        case FL_DEVICE_GROUP_ID_ID:
1530            setId((Integer)value);
1531            break;
1532        case FL_DEVICE_GROUP_ID_NAME:
1533            setName((String)value);
1534            break;
1535        case FL_DEVICE_GROUP_ID_LEAF:
1536            setLeaf((Integer)value);
1537            break;
1538        case FL_DEVICE_GROUP_ID_PARENT:
1539            setParent((Integer)value);
1540            break;
1541        case FL_DEVICE_GROUP_ID_ROOT_GROUP:
1542            setRootGroup((Integer)value);
1543            break;
1544        case FL_DEVICE_GROUP_ID_SCHEDULE:
1545            setSchedule((String)value);
1546            break;
1547        case FL_DEVICE_GROUP_ID_REMARK:
1548            setRemark((String)value);
1549            break;
1550        case FL_DEVICE_GROUP_ID_EXT_BIN:
1551            setExtBin((java.nio.ByteBuffer)value);
1552            break;
1553        case FL_DEVICE_GROUP_ID_EXT_TXT:
1554            setExtTxt((String)value);
1555            break;
1556        case FL_DEVICE_GROUP_ID_CREATE_TIME:
1557            setCreateTime((java.util.Date)value);
1558            break;
1559        case FL_DEVICE_GROUP_ID_UPDATE_TIME:
1560            setUpdateTime((java.util.Date)value);
1561            break;
1562        default:
1563            break;
1564        }
1565    }
1566    
1567    @Override
1568    public <T> T getValue(String column)
1569    {
1570        return getValue(columnIDOf(column));
1571    }
1572
1573    @Override
1574    public <T> void setValue(String column,T value)
1575    {
1576        setValue(columnIDOf(column),value);
1577    }
1578    
1579    /**
1580     * @param column column name
1581     * @return column id for the given field name or negative if {@code column} is invalid name 
1582     */
1583    public static int columnIDOf(String column){
1584        int index = FL_DEVICE_GROUP_FIELDS_LIST.indexOf(column);
1585        return  index < 0 
1586            ? FL_DEVICE_GROUP_JAVA_FIELDS_LIST.indexOf(column)
1587            : index;
1588    }
1589    
1590    public static String columnNameOf(int columnId){
1591        try{
1592            return FL_DEVICE_GROUP_FIELDS_LIST.get(columnId);
1593        } catch(IndexOutOfBoundsException e){
1594            return null;
1595        }
1596    }
1597    
1598    public static Class<?> typeOf(int columnId){
1599        try{
1600            return FL_DEVICE_GROUP_FIELD_TYPES[columnId];
1601        } catch(IndexOutOfBoundsException e){
1602            return null;
1603        }
1604    }
1605    
1606    public static final Builder builder(){
1607        return new Builder().reset();
1608    }
1609    /** 
1610     * a builder for DeviceGroupBean,the template instance is thread local variable
1611     * a instance of Builder can be reused.
1612     */
1613    public static final class Builder{
1614        /** DeviceGroupBean instance used for template to create new DeviceGroupBean instance. */
1615        static final ThreadLocal<DeviceGroupBean> TEMPLATE = new ThreadLocal<DeviceGroupBean>(){
1616            @Override
1617            protected DeviceGroupBean initialValue() {
1618                return new DeviceGroupBean();
1619            }};
1620        private Builder() {}
1621        /** 
1622         * reset the bean as template 
1623         * @see DeviceGroupBean#reset()
1624         */
1625        public Builder reset(){
1626            TEMPLATE.get().reset();
1627            return this;
1628        }
1629        /** set a bean as template,must not be {@code null} */
1630        public Builder template(DeviceGroupBean bean){
1631            if(null == bean){
1632                throw new NullPointerException();
1633            }
1634            TEMPLATE.set(bean);
1635            return this;
1636        }
1637        /** return a clone instance of {@link #TEMPLATE}*/
1638        public DeviceGroupBean build(){
1639            return TEMPLATE.get().clone();
1640        }
1641        /** 
1642         * fill the field : fl_device_group.id
1643         * @param id 设备组id
1644         * @see DeviceGroupBean#getId()
1645         * @see DeviceGroupBean#setId(Integer)
1646         */
1647        public Builder id(Integer id){
1648            TEMPLATE.get().setId(id);
1649            return this;
1650        }
1651        /** 
1652         * fill the field : fl_device_group.name
1653         * @param name 设备组名
1654         * @see DeviceGroupBean#getName()
1655         * @see DeviceGroupBean#setName(String)
1656         */
1657        public Builder name(String name){
1658            TEMPLATE.get().setName(name);
1659            return this;
1660        }
1661        /** 
1662         * fill the field : fl_device_group.leaf
1663         * @param leaf 是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可
1664         * @see DeviceGroupBean#getLeaf()
1665         * @see DeviceGroupBean#setLeaf(Integer)
1666         */
1667        public Builder leaf(Integer leaf){
1668            TEMPLATE.get().setLeaf(leaf);
1669            return this;
1670        }
1671        /** 
1672         * fill the field : fl_device_group.parent
1673         * @param parent 上一级设备组id
1674         * @see DeviceGroupBean#getParent()
1675         * @see DeviceGroupBean#setParent(Integer)
1676         */
1677        public Builder parent(Integer parent){
1678            TEMPLATE.get().setParent(parent);
1679            return this;
1680        }
1681        /** 
1682         * fill the field : fl_device_group.root_group
1683         * @param rootGroup 指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组
1684         * @see DeviceGroupBean#getRootGroup()
1685         * @see DeviceGroupBean#setRootGroup(Integer)
1686         */
1687        public Builder rootGroup(Integer rootGroup){
1688            TEMPLATE.get().setRootGroup(rootGroup);
1689            return this;
1690        }
1691        /** 
1692         * fill the field : fl_device_group.schedule
1693         * @param schedule 设备工作时间表,为null或空为7x24小时工作,格式为JSON,参见开发手册
1694         * @see DeviceGroupBean#getSchedule()
1695         * @see DeviceGroupBean#setSchedule(String)
1696         */
1697        public Builder schedule(String schedule){
1698            TEMPLATE.get().setSchedule(schedule);
1699            return this;
1700        }
1701        /** 
1702         * fill the field : fl_device_group.remark
1703         * @param remark 备注
1704         * @see DeviceGroupBean#getRemark()
1705         * @see DeviceGroupBean#setRemark(String)
1706         */
1707        public Builder remark(String remark){
1708            TEMPLATE.get().setRemark(remark);
1709            return this;
1710        }
1711        /** 
1712         * fill the field : fl_device_group.ext_bin
1713         * @param extBin 应用项目自定义二进制扩展字段(最大64KB)
1714         * @see DeviceGroupBean#getExtBin()
1715         * @see DeviceGroupBean#setExtBin(java.nio.ByteBuffer)
1716         */
1717        public Builder extBin(java.nio.ByteBuffer extBin){
1718            TEMPLATE.get().setExtBin(extBin);
1719            return this;
1720        }
1721        /** 
1722         * fill the field : fl_device_group.ext_txt
1723         * @param extTxt 应用项目自定义文本扩展字段(最大64KB)
1724         * @see DeviceGroupBean#getExtTxt()
1725         * @see DeviceGroupBean#setExtTxt(String)
1726         */
1727        public Builder extTxt(String extTxt){
1728            TEMPLATE.get().setExtTxt(extTxt);
1729            return this;
1730        }
1731        /** 
1732         * fill the field : fl_device_group.create_time
1733         * @param createTime 
1734         * @see DeviceGroupBean#getCreateTime()
1735         * @see DeviceGroupBean#setCreateTime(java.util.Date)
1736         */
1737        public Builder createTime(java.util.Date createTime){
1738            TEMPLATE.get().setCreateTime(createTime);
1739            return this;
1740        }
1741        /** 
1742         * fill the field : fl_device_group.update_time
1743         * @param updateTime 
1744         * @see DeviceGroupBean#getUpdateTime()
1745         * @see DeviceGroupBean#setUpdateTime(java.util.Date)
1746         */
1747        public Builder updateTime(java.util.Date updateTime){
1748            TEMPLATE.get().setUpdateTime(updateTime);
1749            return this;
1750        }
1751    }
1752}