建造者模式:
需求:给定产品对象、建造对象、导演对象,使得产品对象通过建造对象与导演对象这两个对象的干预组合出客户最终所要的产品
其中建造对象与导演对象互不干预
设计方法:
首先设计出产品类,并构造其属性的getset方法
public class Product {
private String type;
private String name;
private List<String> list;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
}
再设计出建造者的抽象类,抽象类中一般包含产