Last active
July 30, 2025 07:23
-
-
Save trikitrok/396bb57f884025dabeec6c72a1ecbec2 to your computer and use it in GitHub Desktop.
using ClaimBuilder with CRTP
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 class ReadyToOpenClaimBuilder extends ClaimBuilder<ReadyToOpenClaimBuilder> { | |
private Company company; | |
private ReadyToOpenClaimBuilder() { | |
super(); | |
} | |
public static ReadyToOpenClaimBuilder aClaimReadyToOpen() { | |
ReadyToOpenClaimBuilder builder = new ReadyToOpenClaimBuilder(); | |
builder.withStatus(ClaimStatus.ReadyToOpen); | |
return builder; | |
} | |
public ReadyToOpenClaimBuilder withCompany(Company company) { | |
Objects.requireNonNull(company, "Company must not be null"); | |
this.company = company; | |
return this; | |
} | |
public Claim build() { | |
return new ReadyToOpenClaim( | |
buildData(), | |
company | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment