Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class PersonBuilder {
public PersonBuilder() {
}
public StepAge name(String name) {
return new StepAge(new Person(name, -1));
}
public class StepAge {
private final Person building;
public StepAge(Person building) {
this.building = building;
}
public StepBuild age(int age) {
return new StepBuild(new Person(building.name, age));
}
}
public class StepBuild {
private final Person building;
public StepBuild(Person building) {
this.building = building;
}
public Person build() {
return building;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment