public class DemoClass{
public String prop1;
public String prop2;
private DemoClass(){
}
//一个静态类Builder
public static class Builder{
private demoClass = new DemoClass();
public Builder(String prop1,String prop2){
demoClass.prop1 = prop1;
demoClass.prop2 = prop2;
}
public ParameterMap build(){
return demoClass;
}
}
}
//如何使用呢
DemoClass demoClass = new DemoClass.Builder(prop1,prop2);