@@ -42,7 +42,7 @@ public static class Builder<B extends Builder<B>> extends JsonLDObject.Builder<B
4242 private Object issuer ;
4343 private Date validFrom ;
4444 private Date validUntil ;
45- private CredentialSubject credentialSubject ;
45+ private List < CredentialSubject > credentialSubject ;
4646 private List <CredentialStatus > credentialStatus ;
4747 private String name ;
4848 private String description ;
@@ -72,7 +72,7 @@ public VerifiableCredentialV2 build() {
7272 if (this .issuer != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , VerifiableCredentialKeywords .JSONLD_TERM_ISSUER , this .issuer instanceof URI ? JsonLDUtils .uriToString ((URI ) this .issuer ) : this .issuer );
7373 if (this .validFrom != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , VerifiableCredentialKeywords .JSONLD_TERM_VALIDFROM , JsonLDUtils .dateToString (this .validFrom ));
7474 if (this .validUntil != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , VerifiableCredentialKeywords .JSONLD_TERM_VALIDUNTIL , JsonLDUtils .dateToString (this .validUntil ));
75- if (this .credentialSubject != null ) this .credentialSubject .addToJsonLDObject (this .jsonLdObject );
75+ if (this .credentialSubject != null ) this .credentialSubject .forEach ( credentialSubject -> credentialSubject . addToJsonLDObject (this .jsonLdObject ) );
7676 if (this .credentialStatus != null ) this .credentialStatus .forEach (credentialStatus -> credentialStatus .addToJsonLDObject (this .jsonLdObject ));
7777 if (this .name != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , VerifiableCredentialKeywords .JSONLD_TERM_NAME , this .name );
7878 if (this .description != null ) JsonLDUtils .jsonLdAdd (this .jsonLdObject , VerifiableCredentialKeywords .JSONLD_TERM_NAME , this .description );
@@ -108,7 +108,8 @@ public B validUntil(Date validUntil) {
108108 }
109109
110110 public B credentialSubject (CredentialSubject credentialSubject ) {
111- this .credentialSubject = credentialSubject ;
111+ if (this .credentialSubject == null ) this .credentialSubject = new ArrayList <>();
112+ this .credentialSubject .add (credentialSubject );
112113 return (B ) this ;
113114 }
114115
@@ -258,6 +259,10 @@ public CredentialSubject getCredentialSubject() {
258259 return CredentialSubject .getFromJsonLDObject (this );
259260 }
260261
262+ public List <CredentialSubject > getCredentialSubjectAsList () {
263+ return CredentialSubject .getFromJsonLDObjectAsList (this );
264+ }
265+
261266 public CredentialStatus getCredentialStatus () {
262267 return CredentialStatus .getFromJsonLDObject (this );
263268 }
0 commit comments