package WEB-INF.classes.wenrgise.ejb.common.helper;

import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Date;

public class QueryValue implements Serializable {
  private String stringValue = null;
  
  private BigDecimal bigDecimalValue = BigDecimal.valueOf(0L);
  
  private short shortValue = 0;
  
  private int intValue = 0;
  
  private long longValue = 0L;
  
  private float floatValue = 0.0F;
  
  private double doubleValue = 0.0D;
  
  private Date dateValue = null;
  
  private Blob blobValue = null;
  
  private Clob clobValue = null;
  
  public void setString(String value) {
    this.stringValue = value;
  }
  
  public String getString() {
    return this.stringValue;
  }
  
  public void setBigDecimal(BigDecimal value) {
    this.bigDecimalValue = value;
    this.stringValue = (null != value) ? value.toString() : null;
  }
  
  public BigDecimal getBigDecimal() {
    return this.bigDecimalValue;
  }
  
  public void setShort(short value) {
    this.shortValue = value;
    Short shrt = new Short(value);
    this.stringValue = (null != shrt) ? shrt.toString() : null;
  }
  
  public short getShort() {
    return this.shortValue;
  }
  
  public void setInt(int value) {
    this.intValue = value;
    Integer iValue = new Integer(value);
    this.stringValue = (null != iValue) ? iValue.toString() : null;
  }
  
  public int getInt() {
    return this.intValue;
  }
  
  public void setLong(long value) {
    this.longValue = value;
    Long lValue = new Long(value);
    this.stringValue = (null != lValue) ? lValue.toString() : null;
  }
  
  public long getLong() {
    return this.longValue;
  }
  
  public void setFloat(float value) {
    this.floatValue = value;
    Float fValue = new Float(value);
    this.stringValue = (null != fValue) ? fValue.toString() : null;
  }
  
  public float getFloat() {
    return this.floatValue;
  }
  
  public void setDouble(double value) {
    this.doubleValue = value;
    Double dValue = new Double(value);
    this.stringValue = (null != dValue) ? dValue.toString() : null;
  }
  
  public double getDouble() {
    return this.doubleValue;
  }
  
  public void setDate(Date value) {
    this.dateValue = value;
    this.stringValue = (null != value) ? value.toString() : null;
  }
  
  public void setDate(Date value) {
    if (null == value) {
      this.stringValue = null;
      this.dateValue = null;
      return;
    } 
    this.dateValue = new Date(value.getTime());
    this.stringValue = this.dateValue.toString();
  }
  
  public Date getDate() {
    return this.dateValue;
  }
  
  public void setTime(Date value) {
    setDate(value);
  }
  
  public void setTime(Time value) {
    if (null == value) {
      this.stringValue = null;
      this.dateValue = null;
      return;
    } 
    this.dateValue = new Date(value.getTime());
    this.stringValue = this.dateValue.toString();
  }
  
  public Date getTime() {
    return this.dateValue;
  }
  
  public void setTimestamp(Timestamp value) {
    if (null == value) {
      this.stringValue = null;
      this.dateValue = null;
      return;
    } 
    this.dateValue = new Date(value.getTime() + (value.getNanos() / 1000000));
    this.stringValue = this.dateValue.toString();
  }
  
  public Date getTimestamp() {
    return this.dateValue;
  }
  
  public void setBlob(Blob value) {
    this.blobValue = value;
  }
  
  public Blob getBlob() {
    return this.blobValue;
  }
  
  public void setClob(Clob value) {
    this.clobValue = value;
  }
  
  public Clob getClob() {
    return this.clobValue;
  }
}
