package facade;
public class Customer {
private String name;
private String address;
private Order order;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public void save(){
}
}
Order.java
package facade;
public class Order {
private String sku;
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
public void save(){
}
}
CustomerFacade.java
package facade;
public class CustomerFacade {
public void placeOrder(String customerName, String customerAddress, String sku){
Customer customer = new Customer();
customer.setName(customerName);
customer.setAddress(customerAddress);
Order order = new Order();
order.setSku(sku);
customer.setOrder(order);
customer.save();
order.save();
}
}
FacadeTest.java
package facade;
public class FacadeTest {
public static void main(String[] args) {
CustomerFacade customerFacade = new CustomerFacade();
customerFacade.placeOrder("customerName", "customerAddress", "sku");
}
}
you may download the source code.
No comments:
Post a Comment