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