net.gdface.facedb.dborm.image.FdImageBean Maven / Gradle / Ivy
// ______________________________________________________
// 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.facedb.dborm.image;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import net.gdface.facedb.dborm.Constant;
import net.gdface.facedb.dborm.BaseBean;
import net.gdface.facedb.dborm.CompareToBuilder;
import net.gdface.facedb.dborm.EqualsBuilder;
import net.gdface.facedb.dborm.HashCodeBuilder;
/**
* FdImageBean is a mapping of fd_image Table.
*
Meta Data Information (in progress):
*
* - comments: 图像信息存储表,用于存储系统中所有用到的图像数据,表中只包含图像基本信息,图像二进制源数据存在在fd_store中(md5对应)
*
* @author guyadong
*/
public class FdImageBean
implements Serializable,BaseBean,Comparable,Constant,Cloneable
{
private static final long serialVersionUID = -5146416043298528841L;
/** NULL {@link FdImageBean} bean , IMMUTABLE instance */
public static final FdImageBean NULL = new FdImageBean().asNULL().asImmutable();
/** comments:主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key */
private String md5;
/** comments:图像格式 */
private String format;
/** comments:图像宽度 */
private Integer width;
/** comments:图像高度 */
private Integer height;
/** comments:通道数 */
private Integer depth;
/** comments:图像中的人脸数目 */
private Integer faceNum;
private java.util.Date updateTime;
private java.util.Date createTime;
/** flag whether {@code this} can be modified */
private Boolean immutable;
/** columns modified flag */
private long modified;
/** columns initialized flag */
private long initialized;
private boolean isNew;
/**
* set immutable status
* @return {@code this}
*/
private FdImageBean immutable(Boolean immutable) {
this.immutable = immutable;
return this;
}
/**
* set {@code this} as immutable object
* @return {@code this}
*/
public FdImageBean 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 FdImageBean checkMutable(){
if(!mutable()){
throw new IllegalStateException("this is a immutable object");
}
return this;
}
/**
* return a new mutable copy of this object.
* @return
*/
public FdImageBean 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 long getModified(){
return modified;
}
/**
* @param modified the modified status bit to be assigned to {@link #modified}
*/
public void setModified(long modified){
this.modified = modified;
}
/**
* @return the initialized status of columns
*/
public long getInitialized(){
return initialized;
}
/**
* @param initialized the initialized status bit to be assigned to {@link #initialized}
*/
public void setInitialized(long initialized){
this.initialized = initialized;
}
protected static final >boolean equals(T a, T b) {
return a == b || (a != null && 0==a.compareTo(b));
}
public FdImageBean(){
super();
reset();
}
/**
* construct a new instance filled with primary keys
* @param md5 PK# 1
*/
public FdImageBean(String md5){
this();
setMd5(md5);
}
/**
* Getter method for {@link #md5}.
* PRIMARY KEY.
* Meta Data Information (in progress):
*
* - full name: fd_image.md5
* - imported key: fd_face.image_md5
* - comments: 主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key
* - NOT NULL
* - column size: 32
* - JDBC type returned by the driver: Types.CHAR
*
*
* @return the value of md5
*/
public String getMd5(){
return md5;
}
/**
* Setter method for {@link #md5}.
* 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 md5
*/
public void setMd5(String newVal)
{
checkMutable();
if (Objects.equals(newVal, md5)) {
return;
}
md5 = newVal;
modified |= FD_IMAGE_ID_MD5_MASK;
initialized |= FD_IMAGE_ID_MD5_MASK;
}
/**
* Determines if the md5 has been modified.
*
* @return true if the field has been modified, false if the field has not been modified
*/
public boolean checkMd5Modified()
{
return 0L != (modified & FD_IMAGE_ID_MD5_MASK);
}
/**
* Determines if the md5 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 checkMd5Initialized()
{
return 0L != (initialized & FD_IMAGE_ID_MD5_MASK);
}
/**
* Getter method for {@link #format}.
* Meta Data Information (in progress):
*
* - full name: fd_image.format
* - comments: 图像格式
* - column size: 32
* - JDBC type returned by the driver: Types.VARCHAR
*
*
* @return the value of format
*/
public String getFormat(){
return format;
}
/**
* Setter method for {@link #format}.
* 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 format
*/
public void setFormat(String newVal)
{
checkMutable();
if (Objects.equals(newVal, format)) {
return;
}
format = newVal;
modified |= FD_IMAGE_ID_FORMAT_MASK;
initialized |= FD_IMAGE_ID_FORMAT_MASK;
}
/**
* Determines if the format has been modified.
*
* @return true if the field has been modified, false if the field has not been modified
*/
public boolean checkFormatModified()
{
return 0L != (modified & FD_IMAGE_ID_FORMAT_MASK);
}
/**
* Determines if the format 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 checkFormatInitialized()
{
return 0L != (initialized & FD_IMAGE_ID_FORMAT_MASK);
}
/**
* Getter method for {@link #width}.
* Meta Data Information (in progress):
*
* - full name: fd_image.width
* - comments: 图像宽度
* - NOT NULL
* - column size: 10
* - JDBC type returned by the driver: Types.INTEGER
*
*
* @return the value of width
*/
public Integer getWidth(){
return width;
}
/**
* Setter method for {@link #width}.
* 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 width
*/
public void setWidth(Integer newVal)
{
checkMutable();
if (Objects.equals(newVal, width)) {
return;
}
width = newVal;
modified |= FD_IMAGE_ID_WIDTH_MASK;
initialized |= FD_IMAGE_ID_WIDTH_MASK;
}
/**
* Setter method for {@link #width}.
* Convenient for those who do not want to deal with Objects for primary types.
*
* @param newVal the new value to be assigned to width
*/
public void setWidth(int newVal)
{
setWidth(new Integer(newVal));
}
/**
* Determines if the width has been modified.
*
* @return true if the field has been modified, false if the field has not been modified
*/
public boolean checkWidthModified()
{
return 0L != (modified & FD_IMAGE_ID_WIDTH_MASK);
}
/**
* Determines if the width 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 checkWidthInitialized()
{
return 0L != (initialized & FD_IMAGE_ID_WIDTH_MASK);
}
/**
* Getter method for {@link #height}.
* Meta Data Information (in progress):
*
* - full name: fd_image.height
* - comments: 图像高度
* - NOT NULL
* - column size: 10
* - JDBC type returned by the driver: Types.INTEGER
*
*
* @return the value of height
*/
public Integer getHeight(){
return height;
}
/**
* Setter method for {@link #height}.
* 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 height
*/
public void setHeight(Integer newVal)
{
checkMutable();
if (Objects.equals(newVal, height)) {
return;
}
height = newVal;
modified |= FD_IMAGE_ID_HEIGHT_MASK;
initialized |= FD_IMAGE_ID_HEIGHT_MASK;
}
/**
* Setter method for {@link #height}.
* Convenient for those who do not want to deal with Objects for primary types.
*
* @param newVal the new value to be assigned to height
*/
public void setHeight(int newVal)
{
setHeight(new Integer(newVal));
}
/**
* Determines if the height has been modified.
*
* @return true if the field has been modified, false if the field has not been modified
*/
public boolean checkHeightModified()
{
return 0L != (modified & FD_IMAGE_ID_HEIGHT_MASK);
}
/**
* Determines if the height 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 checkHeightInitialized()
{
return 0L != (initialized & FD_IMAGE_ID_HEIGHT_MASK);
}
/**
* Getter method for {@link #depth}.
* Meta Data Information (in progress):
*
* - full name: fd_image.depth
* - comments: 通道数
* - default value: '0'
* - NOT NULL
* - column size: 10
* - JDBC type returned by the driver: Types.INTEGER
*
*
* @return the value of depth
*/
public Integer getDepth(){
return depth;
}
/**
* Setter method for {@link #depth}.
* 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 depth
*/
public void setDepth(Integer newVal)
{
checkMutable();
if (Objects.equals(newVal, depth)) {
return;
}
depth = newVal;
modified |= FD_IMAGE_ID_DEPTH_MASK;
initialized |= FD_IMAGE_ID_DEPTH_MASK;
}
/**
* Setter method for {@link #depth}.
* Convenient for those who do not want to deal with Objects for primary types.
*
* @param newVal the new value to be assigned to depth
*/
public void setDepth(int newVal)
{
setDepth(new Integer(newVal));
}
/**
* Determines if the depth has been modified.
*
* @return true if the field has been modified, false if the field has not been modified
*/
public boolean checkDepthModified()
{
return 0L != (modified & FD_IMAGE_ID_DEPTH_MASK);
}
/**
* Determines if the depth 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 checkDepthInitialized()
{
return 0L != (initialized & FD_IMAGE_ID_DEPTH_MASK);
}
/**
* Getter method for {@link #faceNum}.
* Meta Data Information (in progress):
*
* - full name: fd_image.face_num
* - comments: 图像中的人脸数目
* - default value: '0'
* - NOT NULL
* - column size: 10
* - JDBC type returned by the driver: Types.INTEGER
*
*
* @return the value of faceNum
*/
public Integer getFaceNum(){
return faceNum;
}
/**
* Setter method for {@link #faceNum}.
* 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 faceNum
*/
public void setFaceNum(Integer newVal)
{
checkMutable();
if (Objects.equals(newVal, faceNum)) {
return;
}
faceNum = newVal;
modified |= FD_IMAGE_ID_FACE_NUM_MASK;
initialized |= FD_IMAGE_ID_FACE_NUM_MASK;
}
/**
* Setter method for {@link #faceNum}.
* Convenient for those who do not want to deal with Objects for primary types.
*
* @param newVal the new value to be assigned to faceNum
*/
public void setFaceNum(int newVal)
{
setFaceNum(new Integer(newVal));
}
/**
* Determines if the faceNum has been modified.
*
* @return true if the field has been modified, false if the field has not been modified
*/
public boolean checkFaceNumModified()
{
return 0L != (modified & FD_IMAGE_ID_FACE_NUM_MASK);
}
/**
* Determines if the faceNum 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 checkFaceNumInitialized()
{
return 0L != (initialized & FD_IMAGE_ID_FACE_NUM_MASK);
}
/**
* Getter method for {@link #updateTime}.
* Meta Data Information (in progress):
*
* - full name: fd_image.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();
if (Objects.equals(newVal, updateTime)) {
return;
}
updateTime = newVal;
modified |= FD_IMAGE_ID_UPDATE_TIME_MASK;
initialized |= FD_IMAGE_ID_UPDATE_TIME_MASK;
}
/**
* Setter method for {@link #updateTime}.
* Convenient for those who do not want to deal with Objects for primary types.
*
* @param newVal the new value to be assigned to updateTime
*/
public void setUpdateTime(long newVal)
{
setUpdateTime(new java.util.Date(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 & FD_IMAGE_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 & FD_IMAGE_ID_UPDATE_TIME_MASK);
}
/**
* Getter method for {@link #createTime}.
* Meta Data Information (in progress):
*
* - full name: fd_image.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();
if (Objects.equals(newVal, createTime)) {
return;
}
createTime = newVal;
modified |= FD_IMAGE_ID_CREATE_TIME_MASK;
initialized |= FD_IMAGE_ID_CREATE_TIME_MASK;
}
/**
* Setter method for {@link #createTime}.
* Convenient for those who do not want to deal with Objects for primary types.
*
* @param newVal the new value to be assigned to createTime
*/
public void setCreateTime(long newVal)
{
setCreateTime(new java.util.Date(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 & FD_IMAGE_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 & FD_IMAGE_ID_CREATE_TIME_MASK);
}
@Override
public boolean isModified()
{
return 0 != modified;
}
@Override
public boolean isModified(int columnID){
switch ( columnID ){
case FD_IMAGE_ID_MD5:
return checkMd5Modified();
case FD_IMAGE_ID_FORMAT:
return checkFormatModified();
case FD_IMAGE_ID_WIDTH:
return checkWidthModified();
case FD_IMAGE_ID_HEIGHT:
return checkHeightModified();
case FD_IMAGE_ID_DEPTH:
return checkDepthModified();
case FD_IMAGE_ID_FACE_NUM:
return checkFaceNumModified();
case FD_IMAGE_ID_UPDATE_TIME:
return checkUpdateTimeModified();
case FD_IMAGE_ID_CREATE_TIME:
return checkCreateTimeModified();
default:
return false;
}
}
@Override
public boolean isInitialized(int columnID){
switch(columnID) {
case FD_IMAGE_ID_MD5:
return checkMd5Initialized();
case FD_IMAGE_ID_FORMAT:
return checkFormatInitialized();
case FD_IMAGE_ID_WIDTH:
return checkWidthInitialized();
case FD_IMAGE_ID_HEIGHT:
return checkHeightInitialized();
case FD_IMAGE_ID_DEPTH:
return checkDepthInitialized();
case FD_IMAGE_ID_FACE_NUM:
return checkFaceNumInitialized();
case FD_IMAGE_ID_UPDATE_TIME:
return checkUpdateTimeInitialized();
case FD_IMAGE_ID_CREATE_TIME:
return checkCreateTimeInitialized();
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 = 0L;
}
@Override
public void resetPrimaryKeysModified()
{
modified &= (~(FD_IMAGE_ID_MD5_MASK));
}
/**
* Resets columns modification status except primary keys to 'not modified'.
*/
public void resetModifiedExceptPrimaryKeys()
{
modified &= (~(FD_IMAGE_ID_FORMAT_MASK |
FD_IMAGE_ID_WIDTH_MASK |
FD_IMAGE_ID_HEIGHT_MASK |
FD_IMAGE_ID_DEPTH_MASK |
FD_IMAGE_ID_FACE_NUM_MASK |
FD_IMAGE_ID_UPDATE_TIME_MASK |
FD_IMAGE_ID_CREATE_TIME_MASK));
}
/**
* Resets the object initialization status to 'not initialized'.
*/
private void resetInitialized()
{
initialized = 0L;
}
/** reset all fields to initial value, equal to a new bean */
public void reset(){
checkMutable();
this.md5 = null;
this.format = null;
this.width = null;
this.height = null;
/* DEFAULT:'0'*/
this.depth = new Integer(0);
/* DEFAULT:'0'*/
this.faceNum = new Integer(0);
/* DEFAULT:'CURRENT_TIMESTAMP'*/
this.updateTime = null;
/* DEFAULT:'CURRENT_TIMESTAMP'*/
this.createTime = null;
this.isNew = true;
this.modified = 0L;
this.initialized = (FD_IMAGE_ID_DEPTH_MASK | FD_IMAGE_ID_FACE_NUM_MASK);
}
@Override
public boolean equals(Object object)
{
if (!(object instanceof FdImageBean)) {
return false;
}
FdImageBean obj = (FdImageBean) object;
return new EqualsBuilder()
.append(getMd5(), obj.getMd5())
.append(getFormat(), obj.getFormat())
.append(getWidth(), obj.getWidth())
.append(getHeight(), obj.getHeight())
.append(getDepth(), obj.getDepth())
.append(getFaceNum(), obj.getFaceNum())
.append(getUpdateTime(), obj.getUpdateTime())
.append(getCreateTime(), obj.getCreateTime())
.isEquals();
}
@Override
public int hashCode()
{
return new HashCodeBuilder(-82280557, -700257973)
.append(getMd5())
.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(checkMd5Initialized()){
if(!notNull || null != getMd5()){
if(count++ >0){
builder.append(",");
}
builder.append("md5=");
append(builder,fullIfStringOrBytes,getMd5());
}
}
if(checkFormatInitialized()){
if(!notNull || null != getFormat()){
if(count++ >0){
builder.append(",");
}
builder.append("format=");
append(builder,fullIfStringOrBytes,getFormat());
}
}
if(checkWidthInitialized()){
if(!notNull || null != getWidth()){
if(count++ >0){
builder.append(",");
}
builder.append("width=");
append(builder,fullIfStringOrBytes,getWidth());
}
}
if(checkHeightInitialized()){
if(!notNull || null != getHeight()){
if(count++ >0){
builder.append(",");
}
builder.append("height=");
append(builder,fullIfStringOrBytes,getHeight());
}
}
if(checkDepthInitialized()){
if(!notNull || null != getDepth()){
if(count++ >0){
builder.append(",");
}
builder.append("depth=");
append(builder,fullIfStringOrBytes,getDepth());
}
}
if(checkFaceNumInitialized()){
if(!notNull || null != getFaceNum()){
if(count++ >0){
builder.append(",");
}
builder.append("face_num=");
append(builder,fullIfStringOrBytes,getFaceNum());
}
}
if(checkUpdateTimeInitialized()){
if(!notNull || null != getUpdateTime()){
if(count++ >0){
builder.append(",");
}
builder.append("update_time=");
append(builder,fullIfStringOrBytes,getUpdateTime());
}
}
if(checkCreateTimeInitialized()){
if(!notNull || null != getCreateTime()){
if(count++ >0){
builder.append(",");
}
builder.append("create_time=");
append(builder,fullIfStringOrBytes,getCreateTime());
}
}
builder.append("]");
return builder.toString();
}
@Override
public int compareTo(FdImageBean object){
return new CompareToBuilder()
.append(getMd5(), object.getMd5())
.append(getFormat(), object.getFormat())
.append(getWidth(), object.getWidth())
.append(getHeight(), object.getHeight())
.append(getDepth(), object.getDepth())
.append(getFaceNum(), object.getFaceNum())
.append(getUpdateTime(), object.getUpdateTime())
.append(getCreateTime(), object.getCreateTime())
.toComparison();
}
@Override
public FdImageBean clone(){
try {
return (FdImageBean) 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 FdImageBean asNULL()
{
checkMutable();
setMd5((String)null);
setFormat((String)null);
setWidth((Integer)null);
setHeight((Integer)null);
setDepth((Integer)null);
setFaceNum((Integer)null);
setUpdateTime((java.util.Date)null);
setCreateTime((java.util.Date)null);
isNew(true);
resetInitialized();
resetIsModified();
return this;
}
/**
* check whether this bean is a NULL bean
* @return {@code true} if {@link {@link #initialized} be set to zero
* @see #asNULL()
*/
public boolean checkNULL(){
return 0L == getInitialized();
}
/**
* @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 FD_IMAGE_ID_MD5:
return (T)getMd5();
case FD_IMAGE_ID_FORMAT:
return (T)getFormat();
case FD_IMAGE_ID_WIDTH:
return (T)getWidth();
case FD_IMAGE_ID_HEIGHT:
return (T)getHeight();
case FD_IMAGE_ID_DEPTH:
return (T)getDepth();
case FD_IMAGE_ID_FACE_NUM:
return (T)getFaceNum();
case FD_IMAGE_ID_UPDATE_TIME:
return (T)getUpdateTime();
case FD_IMAGE_ID_CREATE_TIME:
return (T)getCreateTime();
default:
return null;
}
}
@Override
public void setValue(int columnID,T value)
{
switch( columnID ) {
case FD_IMAGE_ID_MD5:
setMd5((String)value);
break;
case FD_IMAGE_ID_FORMAT:
setFormat((String)value);
break;
case FD_IMAGE_ID_WIDTH:
setWidth((Integer)value);
break;
case FD_IMAGE_ID_HEIGHT:
setHeight((Integer)value);
break;
case FD_IMAGE_ID_DEPTH:
setDepth((Integer)value);
break;
case FD_IMAGE_ID_FACE_NUM:
setFaceNum((Integer)value);
break;
case FD_IMAGE_ID_UPDATE_TIME:
setUpdateTime((java.util.Date)value);
break;
case FD_IMAGE_ID_CREATE_TIME:
setCreateTime((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);
}
/** return column id for the given field name or negative if {@code column} is invalid name */
public static int columnIDOf(String column){
int index = FD_IMAGE_FIELDS_LIST.indexOf(column);
return index < 0
? FD_IMAGE_JAVA_FIELDS_LIST.indexOf(column)
: index;
}
public static final Builder builder(){
return new Builder();
}
/**
* a builder for FdImageBean,the template instance is thread local variable
* a instance of Builder can be reused.
*/
public static final class Builder{
/** FdImageBean instance used for template to create new FdImageBean instance. */
static final ThreadLocal TEMPLATE = new ThreadLocal(){
@Override
protected FdImageBean initialValue() {
return new FdImageBean();
}};
private Builder() {}
/**
* reset the bean as template
* @see FdImageBean#reset()
*/
public Builder reset(){
TEMPLATE.get().reset();
return this;
}
/** set a bean as template,must not be {@code null} */
public Builder template(FdImageBean bean){
if(null == bean){
throw new NullPointerException();
}
TEMPLATE.set(bean);
return this;
}
/** return a clone instance of {@link #TEMPLATE}*/
public FdImageBean build(){
return TEMPLATE.get().clone();
}
/**
* fill the field : fd_image.md5
* @param md5 主键,图像md5检验码,同时也是从 fd_store 获取图像数据的key
* @see {@link FdImageBean#getMd5()}
* @see {@link FdImageBean#setMd5(String)}
*/
public Builder md5(String md5){
TEMPLATE.get().setMd5(md5);
return this;
}
/**
* fill the field : fd_image.format
* @param format 图像格式
* @see {@link FdImageBean#getFormat()}
* @see {@link FdImageBean#setFormat(String)}
*/
public Builder format(String format){
TEMPLATE.get().setFormat(format);
return this;
}
/**
* fill the field : fd_image.width
* @param width 图像宽度
* @see {@link FdImageBean#getWidth()}
* @see {@link FdImageBean#setWidth(Integer)}
*/
public Builder width(Integer width){
TEMPLATE.get().setWidth(width);
return this;
}
/**
* fill the field : fd_image.height
* @param height 图像高度
* @see {@link FdImageBean#getHeight()}
* @see {@link FdImageBean#setHeight(Integer)}
*/
public Builder height(Integer height){
TEMPLATE.get().setHeight(height);
return this;
}
/**
* fill the field : fd_image.depth
* @param depth 通道数
* @see {@link FdImageBean#getDepth()}
* @see {@link FdImageBean#setDepth(Integer)}
*/
public Builder depth(Integer depth){
TEMPLATE.get().setDepth(depth);
return this;
}
/**
* fill the field : fd_image.face_num
* @param faceNum 图像中的人脸数目
* @see {@link FdImageBean#getFaceNum()}
* @see {@link FdImageBean#setFaceNum(Integer)}
*/
public Builder faceNum(Integer faceNum){
TEMPLATE.get().setFaceNum(faceNum);
return this;
}
/**
* fill the field : fd_image.update_time
* @param updateTime
* @see {@link FdImageBean#getUpdateTime()}
* @see {@link FdImageBean#setUpdateTime(java.util.Date)}
*/
public Builder updateTime(java.util.Date updateTime){
TEMPLATE.get().setUpdateTime(updateTime);
return this;
}
/**
* fill the field : fd_image.create_time
* @param createTime
* @see {@link FdImageBean#getCreateTime()}
* @see {@link FdImageBean#setCreateTime(java.util.Date)}
*/
public Builder createTime(java.util.Date createTime){
TEMPLATE.get().setCreateTime(createTime);
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy