Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package domain;
- import java.io.Serializable;
- import java.sql.Timestamp;
- import java.util.Date;
- public class Message implements Serializable {
- private Product productObj;
- private Date currentTimestamp;
- private String region;
- /**
- * Who reads this stuff anyways?
- *
- * @param productObj
- * @param date
- * @param region
- */
- public Message(Product productObj, Date date, String region) {
- this.productObj = productObj;
- this.currentTimestamp = date;
- this.region = region;
- }
- /**
- * Empty constructor!
- *
- */
- public Message() {
- }
- /**
- * Getter
- *
- * @return
- */
- public Product getProductObj() {
- return productObj;
- }
- /**
- * Setter
- *
- * @param productObj
- */
- public void setProductObj(Product productObj) {
- this.productObj = productObj;
- }
- /**
- * Getter
- *
- * @return
- */
- public Date getTimeStamp() {
- return currentTimestamp;
- }
- /**
- * Setter
- *
- * @param setTimeStamp
- */
- public void setTimeStamp(Date timeStamp) {
- this.currentTimestamp = new Date();
- }
- /**
- * Getter
- *
- * @return
- */
- public String getRegion() {
- return region;
- }
- /**
- * Setter
- *
- * @param region
- */
- public void setRegion(String region) {
- this.region = region;
- }
- @Override
- public String toString() {
- return new Timestamp(currentTimestamp.getTime()) + " " + productObj + " " + region;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement