001// ______________________________________________________ 002// Generated by sql2java - https://github.com/10km/sql2java 003// JDBC driver used at code generation time: com.mysql.jdbc.Driver 004// template: bean.java.vm 005// ______________________________________________________ 006package net.gdface.facedb.db; 007import java.io.Serializable; 008import java.util.Objects; 009 010import gu.sql2java.BaseRow; 011 012import com.facebook.swift.codec.ThriftStruct; 013import com.facebook.swift.codec.ThriftField; 014import com.facebook.swift.codec.ThriftField.Requiredness; 015import io.swagger.annotations.ApiModel; 016import io.swagger.annotations.ApiModelProperty; 017import com.fasterxml.jackson.annotation.JsonProperty; 018import com.fasterxml.jackson.annotation.JsonIgnore; 019/** 020 * StoreBean is a mapping of fd_store Table. 021 * <br>Meta Data Information (in progress): 022 * <ul> 023 * <li>comments: 二进制数据存储表 </li> 024 * </ul> 025 * @author guyadong 026*/ 027@ThriftStruct 028@ApiModel(description="二进制数据存储表") 029public final class StoreBean extends BaseRow 030 implements Serializable,Constant 031{ 032 private static final long serialVersionUID = -4461098722616355232L; 033 034 /** comments:主键,md5检验码 */ 035 @ApiModelProperty(value = "主键,md5检验码" ,required=true ,dataType="String") 036 private String md5; 037 038 /** comments:编码类型,GBK,UTF8... */ 039 @ApiModelProperty(value = "编码类型,GBK,UTF8..." ,dataType="String") 040 private String encoding; 041 042 /** comments:二进制数据 */ 043 @ApiModelProperty(value = "二进制数据" ,dataType="ByteBuffer") 044 private java.nio.ByteBuffer data; 045 046 /** columns modified flag */ 047 @ApiModelProperty(value="columns modified flag",dataType="int",required=true) 048 private int modified; 049 /** columns initialized flag */ 050 @ApiModelProperty(value="columns initialized flag",dataType="int",required=true) 051 private int initialized; 052 /** new record flag */ 053 @ApiModelProperty(value="new record flag",dataType="boolean",required=true) 054 private boolean isNew; 055 @ThriftField(value=1,name="_new",requiredness=Requiredness.REQUIRED) 056 @Override 057 public boolean isNew() 058 { 059 return this.isNew; 060 } 061 062 /** 063 * Specifies to the object if it has been set as new. 064 * 065 * @param isNew the boolean value to be assigned to the isNew field 066 */ 067 @ThriftField() 068 @Override 069 public void setNew(boolean isNew) 070 { 071 this.isNew = isNew; 072 } 073 /** 074 * @return the modified status of columns 075 */ 076 @ThriftField(value=2,requiredness=Requiredness.REQUIRED) 077 @Override 078 public int getModified(){ 079 return modified; 080 } 081 082 /** 083 * @param modified the modified status bit to be assigned to {@link #modified} 084 */ 085 @ThriftField() 086 @Override 087 public void setModified(int modified){ 088 this.modified = modified; 089 } 090 /** 091 * @return the initialized status of columns 092 */ 093 @ThriftField(value=3,requiredness=Requiredness.REQUIRED) 094 @Override 095 public int getInitialized(){ 096 return initialized; 097 } 098 099 /** 100 * @param initialized the initialized status bit to be assigned to {@link #initialized} 101 */ 102 @ThriftField() 103 @Override 104 public void setInitialized(int initialized){ 105 this.initialized = initialized; 106 } 107 108 public StoreBean(){ 109 reset(); 110 } 111 /** 112 * construct a new instance filled with primary keys 113 * @param md5 PK# 1 114 */ 115 public StoreBean(String md5){ 116 setMd5(md5); 117 } 118 /** 119 * Getter method for {@link #md5}.<br> 120 * PRIMARY KEY.<br> 121 * Meta Data Information (in progress): 122 * <ul> 123 * <li>full name: fd_store.md5</li> 124 * <li>comments: 主键,md5检验码</li> 125 * <li>NOT NULL</li> 126 * <li>column size: 32</li> 127 * <li>JDBC type returned by the driver: Types.CHAR</li> 128 * </ul> 129 * 130 * @return the value of md5 131 */ 132 @ThriftField(value=4) 133 @JsonProperty("md5") 134 public String getMd5(){ 135 return md5; 136 } 137 /** 138 * Setter method for {@link #md5}.<br> 139 * The new value is set only if equals() says it is different, 140 * or if one of either the new value or the current value is null. 141 * In case the new value is different, it is set and the field is marked as 'modified'. 142 * 143 * @param newVal the new value( NOT NULL) to be assigned to md5 144 */ 145 @ThriftField(name="md5") 146 @JsonProperty("md5") 147 public void setMd5(String newVal) 148 { 149 modified |= FD_STORE_ID_MD5_MASK; 150 initialized |= FD_STORE_ID_MD5_MASK; 151 152 if (Objects.equals(newVal, md5)) { 153 return; 154 } 155 md5 = newVal; 156 } 157 /** 158 * Determines if the md5 has been modified. 159 * 160 * @return true if the field has been modified, false if the field has not been modified 161 */ 162 public boolean checkMd5Modified() 163 { 164 return 0 != (modified & FD_STORE_ID_MD5_MASK); 165 } 166 167 /** 168 * Determines if the md5 has been initialized.<br> 169 * 170 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 171 * 172 * @return true if the field has been initialized, false otherwise 173 */ 174 public boolean checkMd5Initialized() 175 { 176 return 0 != (initialized & FD_STORE_ID_MD5_MASK); 177 } 178 /** 179 * Getter method for {@link #encoding}.<br> 180 * Meta Data Information (in progress): 181 * <ul> 182 * <li>full name: fd_store.encoding</li> 183 * <li>comments: 编码类型,GBK,UTF8...</li> 184 * <li>column size: 16</li> 185 * <li>JDBC type returned by the driver: Types.VARCHAR</li> 186 * </ul> 187 * 188 * @return the value of encoding 189 */ 190 @ThriftField(value=5) 191 @JsonProperty("encoding") 192 public String getEncoding(){ 193 return encoding; 194 } 195 /** 196 * Setter method for {@link #encoding}.<br> 197 * The new value is set only if equals() says it is different, 198 * or if one of either the new value or the current value is null. 199 * In case the new value is different, it is set and the field is marked as 'modified'. 200 * 201 * @param newVal the new value to be assigned to encoding 202 */ 203 @ThriftField(name="encoding") 204 @JsonProperty("encoding") 205 public void setEncoding(String newVal) 206 { 207 modified |= FD_STORE_ID_ENCODING_MASK; 208 initialized |= FD_STORE_ID_ENCODING_MASK; 209 210 if (Objects.equals(newVal, encoding)) { 211 return; 212 } 213 encoding = newVal; 214 } 215 /** 216 * Determines if the encoding has been modified. 217 * 218 * @return true if the field has been modified, false if the field has not been modified 219 */ 220 public boolean checkEncodingModified() 221 { 222 return 0 != (modified & FD_STORE_ID_ENCODING_MASK); 223 } 224 225 /** 226 * Determines if the encoding has been initialized.<br> 227 * 228 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 229 * 230 * @return true if the field has been initialized, false otherwise 231 */ 232 public boolean checkEncodingInitialized() 233 { 234 return 0 != (initialized & FD_STORE_ID_ENCODING_MASK); 235 } 236 /** 237 * Getter method for {@link #data}.<br> 238 * Meta Data Information (in progress): 239 * <ul> 240 * <li>full name: fd_store.data</li> 241 * <li>comments: 二进制数据</li> 242 * <li>column size: 16777215</li> 243 * <li>JDBC type returned by the driver: Types.LONGVARBINARY</li> 244 * </ul> 245 * 246 * @return the value of data 247 */ 248 @ThriftField(value=6) 249 @JsonProperty("data") 250 public java.nio.ByteBuffer getData(){ 251 return data; 252 } 253 /** 254 * Setter method for {@link #data}.<br> 255 * The new value is set only if equals() says it is different, 256 * or if one of either the new value or the current value is null. 257 * In case the new value is different, it is set and the field is marked as 'modified'. 258 * 259 * @param newVal the new value to be assigned to data 260 */ 261 @ThriftField(name="data") 262 @JsonProperty("data") 263 public void setData(java.nio.ByteBuffer newVal) 264 { 265 modified |= FD_STORE_ID_DATA_MASK; 266 initialized |= FD_STORE_ID_DATA_MASK; 267 268 if (Objects.equals(newVal, data)) { 269 return; 270 } 271 data = newVal; 272 } 273 /** 274 * Determines if the data has been modified. 275 * 276 * @return true if the field has been modified, false if the field has not been modified 277 */ 278 public boolean checkDataModified() 279 { 280 return 0 != (modified & FD_STORE_ID_DATA_MASK); 281 } 282 283 /** 284 * Determines if the data has been initialized.<br> 285 * 286 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 287 * 288 * @return true if the field has been initialized, false otherwise 289 */ 290 public boolean checkDataInitialized() 291 { 292 return 0 != (initialized & FD_STORE_ID_DATA_MASK); 293 } 294 295 @Override 296 public boolean beModified() 297 { 298 return 0 != modified; 299 } 300 301 @Override 302 public boolean isModified(int columnID){ 303 return columnID>=0 && columnID < metaData.columnCount && 0 != (modified & (1 << columnID)); 304 } 305 306 @Override 307 public boolean isInitialized(int columnID){ 308 return columnID>=0 && columnID < metaData.columnCount && 0 != (initialized & (1 << columnID)); 309 } 310 311 @Override 312 public void resetIsModified() 313 { 314 modified = 0; 315 } 316 317 @Override 318 public void resetPrimaryKeysModified() 319 { 320 modified &= (~(FD_STORE_ID_MD5_MASK)); 321 } 322 /** 323 * Resets columns modification status except primary keys to 'not modified'. 324 */ 325 public void resetModifiedExceptPrimaryKeys() 326 { 327 modified &= (~(FD_STORE_ID_ENCODING_MASK | 328 FD_STORE_ID_DATA_MASK)); 329 } 330 331 /** reset all fields to initial value, equal to a new bean */ 332 public void reset(){ 333 this.md5 = null; 334 this.encoding = null; 335 this.data = null; 336 this.isNew = true; 337 this.modified = 0; 338 this.initialized = 0; 339 } 340 341 @Override 342 public StoreBean clone(){ 343 return (StoreBean) super.clone(); 344 } 345 346 347 public static final Builder builder(){ 348 return new Builder().reset(); 349 } 350 /** 351 * a builder for StoreBean,the template instance is thread local variable 352 * a instance of Builder can be reused. 353 */ 354 public static final class Builder{ 355 /** StoreBean instance used for template to create new StoreBean instance. */ 356 static final ThreadLocal<StoreBean> TEMPLATE = new ThreadLocal<StoreBean>(){ 357 @Override 358 protected StoreBean initialValue() { 359 return new StoreBean(); 360 }}; 361 private Builder() {} 362 /** 363 * reset the bean as template 364 * @see StoreBean#reset() 365 */ 366 public Builder reset(){ 367 TEMPLATE.get().reset(); 368 return this; 369 } 370 /** set a bean as template,must not be {@code null} */ 371 public Builder template(StoreBean bean){ 372 if(null == bean){ 373 throw new NullPointerException(); 374 } 375 TEMPLATE.set(bean); 376 return this; 377 } 378 /** return a clone instance of {@link #TEMPLATE}*/ 379 public StoreBean build(){ 380 return TEMPLATE.get().clone(); 381 } 382 /** 383 * fill the field : fd_store.md5 384 * @param md5 主键,md5检验码 385 * @see StoreBean#getMd5() 386 * @see StoreBean#setMd5(String) 387 */ 388 public Builder md5(String md5){ 389 TEMPLATE.get().setMd5(md5); 390 return this; 391 } 392 /** 393 * fill the field : fd_store.encoding 394 * @param encoding 编码类型,GBK,UTF8... 395 * @see StoreBean#getEncoding() 396 * @see StoreBean#setEncoding(String) 397 */ 398 public Builder encoding(String encoding){ 399 TEMPLATE.get().setEncoding(encoding); 400 return this; 401 } 402 /** 403 * fill the field : fd_store.data 404 * @param data 二进制数据 405 * @see StoreBean#getData() 406 * @see StoreBean#setData(java.nio.ByteBuffer) 407 */ 408 public Builder data(java.nio.ByteBuffer data){ 409 TEMPLATE.get().setData(data); 410 return this; 411 } 412 } 413}