Last active
August 15, 2021 17:07
-
-
Save mand2/3e9b7b9c88a300176067c99e6f93ebc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.order; | |
import org.json.simple.JSONObject; | |
import java.util.Objects; | |
public class Order { | |
private int orderSeq; | |
private int userSeq; | |
private int storeSeq; | |
public Order(int orderSeq, int userSeq, int storeSeq) { | |
this.orderSeq = orderSeq; | |
this.userSeq = userSeq; | |
this.storeSeq = storeSeq; | |
} | |
public String createMessage() { | |
JSONObject orderMessage = new JSONObject(); | |
orderMessage.put("mode", "send-store-order"); | |
orderMessage.put("orderSeq", this.orderSeq); | |
orderMessage.put("userSeq", this.userSeq); | |
orderMessage.put("storeSeq", this.storeSeq); | |
return orderMessage.toJSONString(); | |
} | |
public int getOrderSeq() { | |
return orderSeq; | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) return true; | |
if (o == null || getClass() != o.getClass()) return false; | |
Order order = (Order) o; | |
return orderSeq == order.orderSeq && | |
userSeq == order.userSeq && | |
storeSeq == order.storeSeq; | |
} | |
@Override | |
public int hashCode() { | |
return Objects.hash(orderSeq, userSeq, storeSeq); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment