Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Build class for Loan model
public class LoanBuilder {
private String name;
private String email;
private BigDecimal amount;
private int installments;
public LoanBuilder name(String name) {
this.name = name;
return this;
}
public LoanBuilder email(String email) {
this.email = email;
return this;
}
public LoanBuilder amount(BigDecimal amount) {
this.amount = amount;
return this;
}
public LoanBuilder installments(int installments) {
this.installments = installments;
return this;
}
public Loan build() {
return new Loan(name, email, amount, installments);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.