Skip to content

Commit

Permalink
feat: add toBuilder() methods to VC classes
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Feb 5, 2025
1 parent 893f6ca commit 14a91c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,19 @@ public String getId() {
return id;
}

public Builder toBuilder() {
return new Builder(this);
}

public static final class Builder {
private final CredentialSubject instance;

private Builder() {
instance = new CredentialSubject();
private Builder(CredentialSubject instance) {
this.instance = instance;
}

public static Builder newInstance() {
return new Builder();
return new Builder(new CredentialSubject());
}

public Builder claims(Map<String, Object> claims) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public DataModelVersion getDataModelVersion() {
return dataModelVersion;
}

public Builder tobuilder() {
return new Builder(this);
}

public static class Builder<T extends VerifiableCredential, B extends Builder<T, B>> {
protected final T instance;

Expand Down

0 comments on commit 14a91c5

Please sign in to comment.