All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.facelog.dborm.device.FlDeviceGroupBean Maven / Gradle / Ivy

There is a newer version: 2.5.1
Show newest version
// ______________________________________________________
// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 
// modified by guyadong from
// sql2java original version https://sourceforge.net/projects/sql2java/ 
// JDBC driver used at code generation time: com.mysql.jdbc.Driver
// template: bean.java.vm
// ______________________________________________________
package net.gdface.facelog.dborm.device;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

import net.gdface.facelog.dborm.Constant;
import net.gdface.facelog.dborm.BaseBean;
import net.gdface.facelog.dborm.CompareToBuilder;
import net.gdface.facelog.dborm.EqualsBuilder;
import net.gdface.facelog.dborm.HashCodeBuilder;
/**
 * FlDeviceGroupBean is a mapping of fl_device_group Table.
 * 
Meta Data Information (in progress): *
    *
  • comments: 设备组信息
  • *
* @author guyadong */ public class FlDeviceGroupBean implements Serializable,BaseBean,Comparable,Constant,Cloneable { private static final long serialVersionUID = -736132485567928706L; /** NULL {@link FlDeviceGroupBean} bean , IMMUTABLE instance */ public static final FlDeviceGroupBean NULL = new FlDeviceGroupBean().asNULL().asImmutable(); /** comments:设备组id */ private Integer id; /** comments:设备组名 */ private String name; /** comments:是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可 */ private Integer leaf; /** comments:上一级设备组id */ private Integer parent; /** comments:指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组 */ private Integer rootGroup; /** comments:备注 */ private String remark; /** comments:应用项目自定义二进制扩展字段(最大64KB) */ private java.nio.ByteBuffer extBin; /** comments:应用项目自定义文本扩展字段(最大64KB) */ private String extTxt; private java.util.Date createTime; private java.util.Date updateTime; /** flag whether {@code this} can be modified */ private Boolean immutable; /** columns modified flag */ private int modified; /** columns initialized flag */ private int initialized; /** new record flag */ private boolean isNew; /** * set immutable status * @return {@code this} */ private FlDeviceGroupBean immutable(Boolean immutable) { this.immutable = immutable; return this; } /** * set {@code this} as immutable object * @return {@code this} */ public FlDeviceGroupBean asImmutable() { return immutable(Boolean.TRUE); } /** * @return {@code true} if {@code this} is a mutable object */ public boolean mutable(){ return !Boolean.TRUE.equals(this.immutable); } /** * @return {@code this} * @throws IllegalStateException if {@code this} is a immutable object */ private FlDeviceGroupBean checkMutable(){ if(!mutable()){ throw new IllegalStateException("this is a immutable object"); } return this; } /** * @return return a new mutable copy of this object. */ public FlDeviceGroupBean cloneMutable(){ return clone().immutable(null); } @Override public boolean isNew() { return this.isNew; } @Override public void isNew(boolean isNew) { this.isNew = isNew; } /** * Specifies to the object if it has been set as new. * * @param isNew the boolean value to be assigned to the isNew field */ public void setNew(boolean isNew) { this.isNew = isNew; } /** * @return the modified status of columns */ public int getModified(){ return modified; } /** * @param modified the modified status bit to be assigned to {@link #modified} */ public void setModified(int modified){ this.modified = modified; } /** * @return the initialized status of columns */ public int getInitialized(){ return initialized; } /** * @param initialized the initialized status bit to be assigned to {@link #initialized} */ public void setInitialized(int initialized){ this.initialized = initialized; } protected static final >boolean equals(T a, T b) { return a == b || (a != null && 0==a.compareTo(b)); } public FlDeviceGroupBean(){ super(); reset(); } /** * construct a new instance filled with primary keys * @param id PK# 1 */ public FlDeviceGroupBean(Integer id){ this(); setId(id); } /** * Getter method for {@link #id}.
* PRIMARY KEY.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.id
  • *
  • imported key: fl_permit.device_group_id
  • *
  • imported key: fl_device.group_id
  • *
  • imported key: fl_device_group.parent
  • *
  • comments: 设备组id
  • *
  • AUTO_INCREMENT
  • *
  • NOT NULL
  • *
  • column size: 10
  • *
  • JDBC type returned by the driver: Types.INTEGER
  • *
* * @return the value of id */ public Integer getId(){ return id; } /** * Setter method for {@link #id}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to id */ public void setId(Integer newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_ID_MASK; initialized |= FL_DEVICE_GROUP_ID_ID_MASK; if (Objects.equals(newVal, id)) { return; } id = newVal; } /** * Determines if the id has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkIdModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_ID_MASK); } /** * Determines if the id has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkIdInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_ID_MASK); } /** * Getter method for {@link #name}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.name
  • *
  • comments: 设备组名
  • *
  • NOT NULL
  • *
  • column size: 32
  • *
  • JDBC type returned by the driver: Types.VARCHAR
  • *
* * @return the value of name */ public String getName(){ return name; } /** * Setter method for {@link #name}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value( NOT NULL) to be assigned to name */ public void setName(String newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_NAME_MASK; initialized |= FL_DEVICE_GROUP_ID_NAME_MASK; if (Objects.equals(newVal, name)) { return; } name = newVal; } /** * Determines if the name has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkNameModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_NAME_MASK); } /** * Determines if the name has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkNameInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_NAME_MASK); } /** * Getter method for {@link #leaf}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.leaf
  • *
  • comments: 是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可
  • *
  • column size: 3
  • *
  • JDBC type returned by the driver: Types.TINYINT
  • *
* * @return the value of leaf */ public Integer getLeaf(){ return leaf; } /** * Setter method for {@link #leaf}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to leaf */ public void setLeaf(Integer newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_LEAF_MASK; initialized |= FL_DEVICE_GROUP_ID_LEAF_MASK; if (Objects.equals(newVal, leaf)) { return; } leaf = newVal; } /** * Determines if the leaf has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkLeafModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_LEAF_MASK); } /** * Determines if the leaf has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkLeafInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_LEAF_MASK); } /** * Getter method for {@link #parent}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.parent
  • *
  • foreign key: fl_device_group.id
  • *
  • comments: 上一级设备组id
  • *
  • column size: 10
  • *
  • JDBC type returned by the driver: Types.INTEGER
  • *
* * @return the value of parent */ public Integer getParent(){ return parent; } /** * Setter method for {@link #parent}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to parent */ public void setParent(Integer newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_PARENT_MASK; initialized |= FL_DEVICE_GROUP_ID_PARENT_MASK; if (Objects.equals(newVal, parent)) { return; } parent = newVal; } /** * Determines if the parent has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkParentModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_PARENT_MASK); } /** * Determines if the parent has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkParentInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_PARENT_MASK); } /** * Getter method for {@link #rootGroup}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.root_group
  • *
  • comments: 指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组
  • *
  • column size: 10
  • *
  • JDBC type returned by the driver: Types.INTEGER
  • *
* * @return the value of rootGroup */ public Integer getRootGroup(){ return rootGroup; } /** * Setter method for {@link #rootGroup}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to rootGroup */ public void setRootGroup(Integer newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK; initialized |= FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK; if (Objects.equals(newVal, rootGroup)) { return; } rootGroup = newVal; } /** * Determines if the rootGroup has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkRootGroupModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK); } /** * Determines if the rootGroup has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkRootGroupInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK); } /** * Getter method for {@link #remark}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.remark
  • *
  • comments: 备注
  • *
  • column size: 256
  • *
  • JDBC type returned by the driver: Types.VARCHAR
  • *
* * @return the value of remark */ public String getRemark(){ return remark; } /** * Setter method for {@link #remark}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to remark */ public void setRemark(String newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_REMARK_MASK; initialized |= FL_DEVICE_GROUP_ID_REMARK_MASK; if (Objects.equals(newVal, remark)) { return; } remark = newVal; } /** * Determines if the remark has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkRemarkModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_REMARK_MASK); } /** * Determines if the remark has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkRemarkInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_REMARK_MASK); } /** * Getter method for {@link #extBin}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.ext_bin
  • *
  • comments: 应用项目自定义二进制扩展字段(最大64KB)
  • *
  • column size: 65535
  • *
  • JDBC type returned by the driver: Types.LONGVARBINARY
  • *
* * @return the value of extBin */ public java.nio.ByteBuffer getExtBin(){ return extBin; } /** * Setter method for {@link #extBin}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to extBin */ public void setExtBin(java.nio.ByteBuffer newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_EXT_BIN_MASK; initialized |= FL_DEVICE_GROUP_ID_EXT_BIN_MASK; if (Objects.equals(newVal, extBin)) { return; } extBin = newVal; } /** * Determines if the extBin has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkExtBinModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_EXT_BIN_MASK); } /** * Determines if the extBin has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkExtBinInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_EXT_BIN_MASK); } /** * Getter method for {@link #extTxt}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.ext_txt
  • *
  • comments: 应用项目自定义文本扩展字段(最大64KB)
  • *
  • column size: 65535
  • *
  • JDBC type returned by the driver: Types.LONGVARCHAR
  • *
* * @return the value of extTxt */ public String getExtTxt(){ return extTxt; } /** * Setter method for {@link #extTxt}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value to be assigned to extTxt */ public void setExtTxt(String newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_EXT_TXT_MASK; initialized |= FL_DEVICE_GROUP_ID_EXT_TXT_MASK; if (Objects.equals(newVal, extTxt)) { return; } extTxt = newVal; } /** * Determines if the extTxt has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkExtTxtModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_EXT_TXT_MASK); } /** * Determines if the extTxt has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkExtTxtInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_EXT_TXT_MASK); } /** * Getter method for {@link #createTime}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.create_time
  • *
  • default value: 'CURRENT_TIMESTAMP'
  • *
  • NOT NULL
  • *
  • column size: 19
  • *
  • JDBC type returned by the driver: Types.TIMESTAMP
  • *
* * @return the value of createTime */ public java.util.Date getCreateTime(){ return createTime; } /** * Setter method for {@link #createTime}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value( NOT NULL) to be assigned to createTime */ public void setCreateTime(java.util.Date newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_CREATE_TIME_MASK; initialized |= FL_DEVICE_GROUP_ID_CREATE_TIME_MASK; if (Objects.equals(newVal, createTime)) { return; } createTime = newVal; } /** * Setter method for {@link #createTime}.
* @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. */ public void setCreateTime(Long newVal) { setCreateTime(null == newVal ? null : new java.util.Date(newVal)); } /** * Determines if the createTime has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkCreateTimeModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_CREATE_TIME_MASK); } /** * Determines if the createTime has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkCreateTimeInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_CREATE_TIME_MASK); } /** * Getter method for {@link #updateTime}.
* Meta Data Information (in progress): *
    *
  • full name: fl_device_group.update_time
  • *
  • default value: 'CURRENT_TIMESTAMP'
  • *
  • NOT NULL
  • *
  • column size: 19
  • *
  • JDBC type returned by the driver: Types.TIMESTAMP
  • *
* * @return the value of updateTime */ public java.util.Date getUpdateTime(){ return updateTime; } /** * Setter method for {@link #updateTime}.
* The new value is set only if equals() says it is different, * or if one of either the new value or the current value is null. * In case the new value is different, it is set and the field is marked as 'modified'. * * @param newVal the new value( NOT NULL) to be assigned to updateTime */ public void setUpdateTime(java.util.Date newVal) { checkMutable(); modified |= FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK; initialized |= FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK; if (Objects.equals(newVal, updateTime)) { return; } updateTime = newVal; } /** * Setter method for {@link #updateTime}.
* @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. */ public void setUpdateTime(Long newVal) { setUpdateTime(null == newVal ? null : new java.util.Date(newVal)); } /** * Determines if the updateTime has been modified. * * @return true if the field has been modified, false if the field has not been modified */ public boolean checkUpdateTimeModified() { return 0L != (modified & FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK); } /** * Determines if the updateTime has been initialized.
* * It is useful to determine if a field is null on purpose or just because it has not been initialized. * * @return true if the field has been initialized, false otherwise */ public boolean checkUpdateTimeInitialized() { return 0L != (initialized & FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK); } ////////////////////////////////////// // referenced bean for FOREIGN KEYS ////////////////////////////////////// /** * The referenced {@link FlDeviceGroupBean} by {@link #parent} .
* FOREIGN KEY (parent) REFERENCES fl_device_group(id) */ private FlDeviceGroupBean referencedByParent; /** * Getter method for {@link #referencedByParent}. * @return FlDeviceGroupBean */ public FlDeviceGroupBean getReferencedByParent() { return this.referencedByParent; } /** * Setter method for {@link #referencedByParent}. * @param reference FlDeviceGroupBean */ public void setReferencedByParent(FlDeviceGroupBean reference) { this.referencedByParent = reference; } @Override public boolean isModified() { return 0 != modified; } @Override public boolean isModified(int columnID){ switch ( columnID ){ case FL_DEVICE_GROUP_ID_ID: return checkIdModified(); case FL_DEVICE_GROUP_ID_NAME: return checkNameModified(); case FL_DEVICE_GROUP_ID_LEAF: return checkLeafModified(); case FL_DEVICE_GROUP_ID_PARENT: return checkParentModified(); case FL_DEVICE_GROUP_ID_ROOT_GROUP: return checkRootGroupModified(); case FL_DEVICE_GROUP_ID_REMARK: return checkRemarkModified(); case FL_DEVICE_GROUP_ID_EXT_BIN: return checkExtBinModified(); case FL_DEVICE_GROUP_ID_EXT_TXT: return checkExtTxtModified(); case FL_DEVICE_GROUP_ID_CREATE_TIME: return checkCreateTimeModified(); case FL_DEVICE_GROUP_ID_UPDATE_TIME: return checkUpdateTimeModified(); default: return false; } } @Override public boolean isInitialized(int columnID){ switch(columnID) { case FL_DEVICE_GROUP_ID_ID: return checkIdInitialized(); case FL_DEVICE_GROUP_ID_NAME: return checkNameInitialized(); case FL_DEVICE_GROUP_ID_LEAF: return checkLeafInitialized(); case FL_DEVICE_GROUP_ID_PARENT: return checkParentInitialized(); case FL_DEVICE_GROUP_ID_ROOT_GROUP: return checkRootGroupInitialized(); case FL_DEVICE_GROUP_ID_REMARK: return checkRemarkInitialized(); case FL_DEVICE_GROUP_ID_EXT_BIN: return checkExtBinInitialized(); case FL_DEVICE_GROUP_ID_EXT_TXT: return checkExtTxtInitialized(); case FL_DEVICE_GROUP_ID_CREATE_TIME: return checkCreateTimeInitialized(); case FL_DEVICE_GROUP_ID_UPDATE_TIME: return checkUpdateTimeInitialized(); default: return false; } } @Override public boolean isModified(String column){ return isModified(columnIDOf(column)); } @Override public boolean isInitialized(String column){ return isInitialized(columnIDOf(column)); } @Override public void resetIsModified() { checkMutable(); modified = 0; } @Override public void resetPrimaryKeysModified() { modified &= (~(FL_DEVICE_GROUP_ID_ID_MASK)); } /** * Resets columns modification status except primary keys to 'not modified'. */ public void resetModifiedExceptPrimaryKeys() { modified &= (~(FL_DEVICE_GROUP_ID_NAME_MASK | FL_DEVICE_GROUP_ID_LEAF_MASK | FL_DEVICE_GROUP_ID_PARENT_MASK | FL_DEVICE_GROUP_ID_ROOT_GROUP_MASK | FL_DEVICE_GROUP_ID_REMARK_MASK | FL_DEVICE_GROUP_ID_EXT_BIN_MASK | FL_DEVICE_GROUP_ID_EXT_TXT_MASK | FL_DEVICE_GROUP_ID_CREATE_TIME_MASK | FL_DEVICE_GROUP_ID_UPDATE_TIME_MASK)); } /** * Resets the object initialization status to 'not initialized'. */ private void resetInitialized() { initialized = 0; } /** reset all fields to initial value, equal to a new bean */ public void reset(){ checkMutable(); this.id = null; this.name = null; this.leaf = null; this.parent = null; this.rootGroup = null; this.remark = null; this.extBin = null; this.extTxt = null; /* DEFAULT:'CURRENT_TIMESTAMP'*/ this.createTime = null; /* DEFAULT:'CURRENT_TIMESTAMP'*/ this.updateTime = null; this.isNew = true; this.modified = 0; this.initialized = 0; } @Override public boolean equals(Object object) { if (!(object instanceof FlDeviceGroupBean)) { return false; } FlDeviceGroupBean obj = (FlDeviceGroupBean) object; return new EqualsBuilder() .append(getId(), obj.getId()) .append(getName(), obj.getName()) .append(getLeaf(), obj.getLeaf()) .append(getParent(), obj.getParent()) .append(getRootGroup(), obj.getRootGroup()) .append(getRemark(), obj.getRemark()) .append(getExtBin(), obj.getExtBin()) .append(getExtTxt(), obj.getExtTxt()) .append(getCreateTime(), obj.getCreateTime()) .append(getUpdateTime(), obj.getUpdateTime()) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder(-82280557, -700257973) .append(getId()) .toHashCode(); } @Override public String toString() { return toString(true,false); } /** * cast byte array to HEX string * * @param input * @return {@code null} if {@code input} is null */ private static final String toHex(byte[] input) { if (null == input){ return null; } StringBuffer sb = new StringBuffer(input.length * 2); for (int i = 0; i < input.length; i++) { sb.append(Character.forDigit((input[i] & 240) >> 4, 16)); sb.append(Character.forDigit(input[i] & 15, 16)); } return sb.toString(); } protected static final StringBuilder append(StringBuilder buffer,boolean full,byte[] value){ if(full || null == value){ buffer.append(toHex(value)); }else{ buffer.append(value.length).append(" bytes"); } return buffer; } private static int stringLimit = 64; private static final int MINIMUM_LIMIT = 16; protected static final StringBuilder append(StringBuilder buffer,boolean full,String value){ if(full || null == value || value.length() <= stringLimit){ buffer.append(value); }else{ buffer.append(value.substring(0,stringLimit - 8)).append(" ...").append(value.substring(stringLimit-4,stringLimit)); } return buffer; } protected static final StringBuilder append(StringBuilder buffer,boolean full,T value){ return buffer.append(value); } public static final void setStringLimit(int limit){ if(limit < MINIMUM_LIMIT){ throw new IllegalArgumentException(String.format("INVALID limit %d,minimum value %d",limit,MINIMUM_LIMIT)); } stringLimit = limit; } @Override public String toString(boolean notNull, boolean fullIfStringOrBytes) { // only output initialized field StringBuilder builder = new StringBuilder(this.getClass().getName()).append("@").append(Integer.toHexString(this.hashCode())).append("["); int count = 0; if(checkIdInitialized()){ if(!notNull || null != getId()){ if(count++ >0){ builder.append(","); } builder.append("id="); append(builder,fullIfStringOrBytes,getId()); } } if(checkNameInitialized()){ if(!notNull || null != getName()){ if(count++ >0){ builder.append(","); } builder.append("name="); append(builder,fullIfStringOrBytes,getName()); } } if(checkLeafInitialized()){ if(!notNull || null != getLeaf()){ if(count++ >0){ builder.append(","); } builder.append("leaf="); append(builder,fullIfStringOrBytes,getLeaf()); } } if(checkParentInitialized()){ if(!notNull || null != getParent()){ if(count++ >0){ builder.append(","); } builder.append("parent="); append(builder,fullIfStringOrBytes,getParent()); } } if(checkRootGroupInitialized()){ if(!notNull || null != getRootGroup()){ if(count++ >0){ builder.append(","); } builder.append("root_group="); append(builder,fullIfStringOrBytes,getRootGroup()); } } if(checkRemarkInitialized()){ if(!notNull || null != getRemark()){ if(count++ >0){ builder.append(","); } builder.append("remark="); append(builder,fullIfStringOrBytes,getRemark()); } } if(checkExtBinInitialized()){ if(!notNull || null != getExtBin()){ if(count++ >0){ builder.append(","); } builder.append("ext_bin="); append(builder,fullIfStringOrBytes,getExtBin()); } } if(checkExtTxtInitialized()){ if(!notNull || null != getExtTxt()){ if(count++ >0){ builder.append(","); } builder.append("ext_txt="); append(builder,fullIfStringOrBytes,getExtTxt()); } } if(checkCreateTimeInitialized()){ if(!notNull || null != getCreateTime()){ if(count++ >0){ builder.append(","); } builder.append("create_time="); append(builder,fullIfStringOrBytes,getCreateTime()); } } if(checkUpdateTimeInitialized()){ if(!notNull || null != getUpdateTime()){ if(count++ >0){ builder.append(","); } builder.append("update_time="); append(builder,fullIfStringOrBytes,getUpdateTime()); } } builder.append("]"); return builder.toString(); } @Override public int compareTo(FlDeviceGroupBean object){ return new CompareToBuilder() .append(getId(), object.getId()) .append(getName(), object.getName()) .append(getLeaf(), object.getLeaf()) .append(getParent(), object.getParent()) .append(getRootGroup(), object.getRootGroup()) .append(getRemark(), object.getRemark()) .append(getExtBin(), object.getExtBin()) .append(getExtTxt(), object.getExtTxt()) .append(getCreateTime(), object.getCreateTime()) .append(getUpdateTime(), object.getUpdateTime()) .toComparison(); } @Override public FlDeviceGroupBean clone(){ try { return (FlDeviceGroupBean) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } /** * Make {@code this} to a NULL bean
* set all fields to null, {@link #modified} and {@link #initialized} be set to 0 * @return {@code this} bean * @author guyadong */ public FlDeviceGroupBean asNULL() { checkMutable(); setId((Integer)null); setName((String)null); setLeaf((Integer)null); setParent((Integer)null); setRootGroup((Integer)null); setRemark((String)null); setExtBin((java.nio.ByteBuffer)null); setExtTxt((String)null); setCreateTime((java.util.Date)null); setUpdateTime((java.util.Date)null); isNew(true); resetInitialized(); resetIsModified(); return this; } /** * check whether this bean is a NULL bean * @return {@code true} if {@link #initialized} be set to zero * @see #asNULL() */ public boolean checkNULL(){ return 0 == getInitialized(); } /** * @param source source list * @return {@code source} replace {@code null} element with null instance({@link #NULL}) */ public static final List replaceNull(List source){ if(null != source){ for(int i = 0,endIndex = source.size();i replaceNullInstance(List source){ if(null != source){ for(int i = 0,endIndex = source.size();iT getValue(int columnID) { switch( columnID ){ case FL_DEVICE_GROUP_ID_ID: return (T)getId(); case FL_DEVICE_GROUP_ID_NAME: return (T)getName(); case FL_DEVICE_GROUP_ID_LEAF: return (T)getLeaf(); case FL_DEVICE_GROUP_ID_PARENT: return (T)getParent(); case FL_DEVICE_GROUP_ID_ROOT_GROUP: return (T)getRootGroup(); case FL_DEVICE_GROUP_ID_REMARK: return (T)getRemark(); case FL_DEVICE_GROUP_ID_EXT_BIN: return (T)getExtBin(); case FL_DEVICE_GROUP_ID_EXT_TXT: return (T)getExtTxt(); case FL_DEVICE_GROUP_ID_CREATE_TIME: return (T)getCreateTime(); case FL_DEVICE_GROUP_ID_UPDATE_TIME: return (T)getUpdateTime(); default: return null; } } @Override public void setValue(int columnID,T value) { switch( columnID ) { case FL_DEVICE_GROUP_ID_ID: setId((Integer)value); break; case FL_DEVICE_GROUP_ID_NAME: setName((String)value); break; case FL_DEVICE_GROUP_ID_LEAF: setLeaf((Integer)value); break; case FL_DEVICE_GROUP_ID_PARENT: setParent((Integer)value); break; case FL_DEVICE_GROUP_ID_ROOT_GROUP: setRootGroup((Integer)value); break; case FL_DEVICE_GROUP_ID_REMARK: setRemark((String)value); break; case FL_DEVICE_GROUP_ID_EXT_BIN: setExtBin((java.nio.ByteBuffer)value); break; case FL_DEVICE_GROUP_ID_EXT_TXT: setExtTxt((String)value); break; case FL_DEVICE_GROUP_ID_CREATE_TIME: setCreateTime((java.util.Date)value); break; case FL_DEVICE_GROUP_ID_UPDATE_TIME: setUpdateTime((java.util.Date)value); break; default: break; } } @Override public T getValue(String column) { return getValue(columnIDOf(column)); } @Override public void setValue(String column,T value) { setValue(columnIDOf(column),value); } /** * @param column column name * @return column id for the given field name or negative if {@code column} is invalid name */ public static int columnIDOf(String column){ int index = FL_DEVICE_GROUP_FIELDS_LIST.indexOf(column); return index < 0 ? FL_DEVICE_GROUP_JAVA_FIELDS_LIST.indexOf(column) : index; } public static final Builder builder(){ return new Builder().reset(); } /** * a builder for FlDeviceGroupBean,the template instance is thread local variable * a instance of Builder can be reused. */ public static final class Builder{ /** FlDeviceGroupBean instance used for template to create new FlDeviceGroupBean instance. */ static final ThreadLocal TEMPLATE = new ThreadLocal(){ @Override protected FlDeviceGroupBean initialValue() { return new FlDeviceGroupBean(); }}; private Builder() {} /** * reset the bean as template * @see FlDeviceGroupBean#reset() */ public Builder reset(){ TEMPLATE.get().reset(); return this; } /** set a bean as template,must not be {@code null} */ public Builder template(FlDeviceGroupBean bean){ if(null == bean){ throw new NullPointerException(); } TEMPLATE.set(bean); return this; } /** return a clone instance of {@link #TEMPLATE}*/ public FlDeviceGroupBean build(){ return TEMPLATE.get().clone(); } /** * fill the field : fl_device_group.id * @param id 设备组id * @see FlDeviceGroupBean#getId() * @see FlDeviceGroupBean#setId(Integer) */ public Builder id(Integer id){ TEMPLATE.get().setId(id); return this; } /** * fill the field : fl_device_group.name * @param name 设备组名 * @see FlDeviceGroupBean#getName() * @see FlDeviceGroupBean#setName(String) */ public Builder name(String name){ TEMPLATE.get().setName(name); return this; } /** * fill the field : fl_device_group.leaf * @param leaf 是否为叶子节点, 1:叶子节点 0:分支节点,null:两者都可 * @see FlDeviceGroupBean#getLeaf() * @see FlDeviceGroupBean#setLeaf(Integer) */ public Builder leaf(Integer leaf){ TEMPLATE.get().setLeaf(leaf); return this; } /** * fill the field : fl_device_group.parent * @param parent 上一级设备组id * @see FlDeviceGroupBean#getParent() * @see FlDeviceGroupBean#setParent(Integer) */ public Builder parent(Integer parent){ TEMPLATE.get().setParent(parent); return this; } /** * fill the field : fl_device_group.root_group * @param rootGroup 指向人员组id,用于应用层定义管理员/操作员的管理边界,此字段不为null代表此设备组为管理边界,指向的人员组为此设备组的拥有者的顶级组 * @see FlDeviceGroupBean#getRootGroup() * @see FlDeviceGroupBean#setRootGroup(Integer) */ public Builder rootGroup(Integer rootGroup){ TEMPLATE.get().setRootGroup(rootGroup); return this; } /** * fill the field : fl_device_group.remark * @param remark 备注 * @see FlDeviceGroupBean#getRemark() * @see FlDeviceGroupBean#setRemark(String) */ public Builder remark(String remark){ TEMPLATE.get().setRemark(remark); return this; } /** * fill the field : fl_device_group.ext_bin * @param extBin 应用项目自定义二进制扩展字段(最大64KB) * @see FlDeviceGroupBean#getExtBin() * @see FlDeviceGroupBean#setExtBin(java.nio.ByteBuffer) */ public Builder extBin(java.nio.ByteBuffer extBin){ TEMPLATE.get().setExtBin(extBin); return this; } /** * fill the field : fl_device_group.ext_txt * @param extTxt 应用项目自定义文本扩展字段(最大64KB) * @see FlDeviceGroupBean#getExtTxt() * @see FlDeviceGroupBean#setExtTxt(String) */ public Builder extTxt(String extTxt){ TEMPLATE.get().setExtTxt(extTxt); return this; } /** * fill the field : fl_device_group.create_time * @param createTime * @see FlDeviceGroupBean#getCreateTime() * @see FlDeviceGroupBean#setCreateTime(java.util.Date) */ public Builder createTime(java.util.Date createTime){ TEMPLATE.get().setCreateTime(createTime); return this; } /** * fill the field : fl_device_group.update_time * @param updateTime * @see FlDeviceGroupBean#getUpdateTime() * @see FlDeviceGroupBean#setUpdateTime(java.util.Date) */ public Builder updateTime(java.util.Date updateTime){ TEMPLATE.get().setUpdateTime(updateTime); return this; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy