public class MandateData {
public final UUID coreId;
public final UUID accountId;
public final String accountRef;
public final String creditorId;
public final String creditorName;
public final String debtorFirstName;
public final String debtorLastName;
public final String branchCode;
public final String accountNumber;
public final LocalDate signingDate;
public final Address debtorAddress;
private MandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
LocalDate signingDate, Address debtorAddress) {
this.coreId = coreId;
this.accountId = accountId;
this.accountRef = accountRef;
this.creditorId = creditorId;
this.creditorName = creditorName;
this.debtorFirstName = debtorFirstName;
this.debtorLastName = debtorLastName;
this.branchCode = branchCode;
this.accountNumber = accountNumber;
this.signingDate = signingDate;
this.debtorAddress = debtorAddress;
}
public static MandateData creationMandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
LocalDate signingDate, Address debtorAddress) {
return new MandateData(coreId, accountId, accountRef, creditorId, creditorName, branchCode, accountNumber, debtorFirstName, debtorLastName, signingDate, debtorAddress);
}
}
There is an ancient and mysterious legend about public static constructor, called createShit. If anyone want's just to create an instance of Shit be aware of it! This is too obvious! just Implement static method with the exactly the same fields, and make constructor private. Don't write a shit!