public class App {
public static void main(String[] args) {
String model = Model.builder().name("jacky").age("43").sex("5643").toString();
System.out.println(model);
}
public static class Model{
private String name;
private String age;
private String sex;
@Override
public String toString() {
return "Model [name=" + name + ", age=" + age + ", sex=" + sex
+ "]";
}
public static Name builder(){
Model model = new Model();
Sex sex = (String s) -> {
model.sex = s;
return model;
};
Age age = (String s) -> {
model.age = s;
return sex;
};
Name name = (String s) -> {
model.name = s;
return age;
};
return name;
}
}
@FunctionalInterface
public static interface Name{
Age name(String name);
}
@FunctionalInterface
public static interface Age {
Sex age(String age);
}
@FunctionalInterface
public static interface Sex{
Model sex(String sex);
}
}
public static void main(String[] args) {
String model = Model.builder().name("jacky").age("43").sex("5643").toString();
System.out.println(model);
}
public static class Model{
private String name;
private String age;
private String sex;
@Override
public String toString() {
return "Model [name=" + name + ", age=" + age + ", sex=" + sex
+ "]";
}
public static Name builder(){
Model model = new Model();
Sex sex = (String s) -> {
model.sex = s;
return model;
};
Age age = (String s) -> {
model.age = s;
return sex;
};
Name name = (String s) -> {
model.name = s;
return age;
};
return name;
}
}
@FunctionalInterface
public static interface Name{
Age name(String name);
}
@FunctionalInterface
public static interface Age {
Sex age(String age);
}
@FunctionalInterface
public static interface Sex{
Model sex(String sex);
}
}