Add domain classes
This commit is contained in:
parent
42a6a0b530
commit
086a01ff2c
71
libraries/src/main/java/com/baeldung/smooks/model/Item.java
Normal file
71
libraries/src/main/java/com/baeldung/smooks/model/Item.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package com.baeldung.smooks.model;
|
||||||
|
|
||||||
|
public class Item {
|
||||||
|
|
||||||
|
public Item() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Item(String code, Double price, Integer quantity) {
|
||||||
|
this.code = code;
|
||||||
|
this.price = price;
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private Double price;
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Double price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(Integer quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
Item item = (Item) o;
|
||||||
|
|
||||||
|
if (code != null ? !code.equals(item.code) : item.code != null) return false;
|
||||||
|
if (price != null ? !price.equals(item.price) : item.price != null) return false;
|
||||||
|
return quantity != null ? quantity.equals(item.quantity) : item.quantity == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = code != null ? code.hashCode() : 0;
|
||||||
|
result = 31 * result + (price != null ? price.hashCode() : 0);
|
||||||
|
result = 31 * result + (quantity != null ? quantity.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Item{" +
|
||||||
|
"code='" + code + '\'' +
|
||||||
|
", price=" + price +
|
||||||
|
", quantity=" + quantity +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
52
libraries/src/main/java/com/baeldung/smooks/model/Order.java
Normal file
52
libraries/src/main/java/com/baeldung/smooks/model/Order.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package com.baeldung.smooks.model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Order {
|
||||||
|
private Date creationDate;
|
||||||
|
private Long number;
|
||||||
|
private Status status;
|
||||||
|
private Supplier supplier;
|
||||||
|
private List<Item> items;
|
||||||
|
|
||||||
|
public Date getCreationDate() {
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationDate(Date creationDate) {
|
||||||
|
this.creationDate = creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(Long number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Status status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Supplier getSupplier() {
|
||||||
|
return supplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupplier(Supplier supplier) {
|
||||||
|
this.supplier = supplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Item> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItems(List<Item> items) {
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.baeldung.smooks.model;
|
||||||
|
|
||||||
|
public enum Status {
|
||||||
|
NEW, IN_PROGRESS, FINISHED
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.baeldung.smooks.model;
|
||||||
|
|
||||||
|
public class Supplier {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
public Supplier() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Supplier(String name, String phoneNumber) {
|
||||||
|
this.name = name;
|
||||||
|
this.phoneNumber = phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneNumber() {
|
||||||
|
return phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneNumber(String phoneNumber) {
|
||||||
|
this.phoneNumber = phoneNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
Supplier supplier = (Supplier) o;
|
||||||
|
|
||||||
|
if (name != null ? !name.equals(supplier.name) : supplier.name != null) return false;
|
||||||
|
return phoneNumber != null ? phoneNumber.equals(supplier.phoneNumber) : supplier.phoneNumber == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = name != null ? name.hashCode() : 0;
|
||||||
|
result = 31 * result + (phoneNumber != null ? phoneNumber.hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user