Added constructors

This commit is contained in:
Xavi Aracil 2024-04-16 14:46:20 +02:00
parent 53e5099085
commit f3e0173129

View File

@ -2,20 +2,35 @@ package org.oneedtech.inspect.vc;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
import foundation.identity.jsonld.JsonLDUtils; import foundation.identity.jsonld.JsonLDUtils;
public class W3CVerifiableCredentialDM2 extends com.danubetech.verifiablecredentials.VerifiableCredential { public class W3CVerifiableCredentialDM2 extends com.danubetech.verifiablecredentials.VerifiableCredential {
public static final URI[] DEFAULT_JSONLD_CONTEXTS = { URI.create(VerifiableCredential.JSONLD_CONTEXT_W3C_CREDENTIALS_V2) }; public static final URI[] DEFAULT_JSONLD_CONTEXTS = { URI.create(VerifiableCredential.JSONLD_CONTEXT_W3C_CREDENTIALS_V2) };
public Date getValidFrom() { @JsonCreator
public W3CVerifiableCredentialDM2() {
super();
}
protected W3CVerifiableCredentialDM2(Map<String, Object> jsonObject) {
super(jsonObject);
}
public static W3CVerifiableCredentialDM2 fromJson(String json) {
return new W3CVerifiableCredentialDM2(readJson(json));
}
public Date getValidFrom() {
return JsonLDUtils.stringToDate(JsonLDUtils.jsonLdGetString(this.getJsonObject(), JSONLD_TERM_VALIDFROM)); return JsonLDUtils.stringToDate(JsonLDUtils.jsonLdGetString(this.getJsonObject(), JSONLD_TERM_VALIDFROM));
} }
public Date getValidUntil() { public Date getValidUntil() {
return JsonLDUtils.stringToDate(JsonLDUtils.jsonLdGetString(this.getJsonObject(), JSONLD_TERM_VALIDUNTIL)); return JsonLDUtils.stringToDate(JsonLDUtils.jsonLdGetString(this.getJsonObject(), JSONLD_TERM_VALIDUNTIL));
} }
private static final String JSONLD_TERM_VALIDFROM = "validFrom"; private static final String JSONLD_TERM_VALIDFROM = "validFrom";
private static final String JSONLD_TERM_VALIDUNTIL = "validUntil"; private static final String JSONLD_TERM_VALIDUNTIL = "validUntil";