Last active
July 30, 2025 07:21
-
-
Save trikitrok/d4d6890af072cfbf11a4e469284349e5 to your computer and use it in GitHub Desktop.
ClaimBuilder using generics initial version abbreviated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imports elided... | |
public abstract class ClaimBuilder<T> { | |
// some fields elided... | |
protected ClaimBuilder() { | |
// setting some defaults elided... | |
} | |
public T withClaimId(String number) { | |
this.claimId = claimId(number); | |
return (T) this; | |
} | |
public T describedAs(String description) { | |
this.description = description; | |
return (T) this; | |
} | |
public T onClaimDate(String date) { | |
this.claimDate = claimDate(date); | |
return (T) this; | |
} | |
// other common setters elided | |
protected ClaimData buildData() { | |
return new ClaimData( | |
claimId, | |
companyId, | |
description, | |
claimDate, | |
policyNumber, | |
status | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment