Advertisement
crownedzero

Message

Nov 15th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. package domain;
  2.  
  3. import java.io.Serializable;
  4. import java.sql.Timestamp;
  5. import java.util.Date;
  6.  
  7. public class Message implements Serializable {
  8.  
  9.     private Product productObj;
  10.     private Date currentTimestamp;
  11.     private String region;
  12.  
  13.     /**
  14.      * Who reads this stuff anyways?
  15.      *
  16.      * @param productObj
  17.      * @param date
  18.      * @param region
  19.      */
  20.     public Message(Product productObj, Date date, String region) {
  21.         this.productObj = productObj;
  22.         this.currentTimestamp = date;
  23.         this.region = region;
  24.     }
  25.  
  26.     /**
  27.      * Empty constructor!
  28.      *
  29.      */
  30.     public Message() {
  31.     }
  32.  
  33.     /**
  34.      * Getter
  35.      *
  36.      * @return
  37.      */
  38.     public Product getProductObj() {
  39.         return productObj;
  40.     }
  41.  
  42.     /**
  43.      * Setter
  44.      *
  45.      * @param productObj
  46.      */
  47.     public void setProductObj(Product productObj) {
  48.         this.productObj = productObj;
  49.     }
  50.  
  51.     /**
  52.      * Getter
  53.      *
  54.      * @return
  55.      */
  56.     public Date getTimeStamp() {
  57.         return currentTimestamp;
  58.     }
  59.  
  60.     /**
  61.      * Setter
  62.      *
  63.      * @param setTimeStamp
  64.      */
  65.     public void setTimeStamp(Date timeStamp) {
  66.         this.currentTimestamp = new Date();
  67.     }
  68.  
  69.     /**
  70.      * Getter
  71.      *
  72.      * @return
  73.      */
  74.     public String getRegion() {
  75.         return region;
  76.     }
  77.  
  78.     /**
  79.      * Setter
  80.      *
  81.      * @param region
  82.      */
  83.     public void setRegion(String region) {
  84.         this.region = region;
  85.     }
  86.  
  87.     @Override
  88.     public String toString() {
  89.         return new Timestamp(currentTimestamp.getTime()) + " " + productObj + " " + region;
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement