diff --git a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/W3CVerifiableCredentialDM2.java b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/W3CVerifiableCredentialDM2.java index cea520c..5f0ae74 100644 --- a/inspector-vc/src/main/java/org/oneedtech/inspect/vc/W3CVerifiableCredentialDM2.java +++ b/inspector-vc/src/main/java/org/oneedtech/inspect/vc/W3CVerifiableCredentialDM2.java @@ -2,20 +2,35 @@ package org.oneedtech.inspect.vc; import java.net.URI; import java.util.Date; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonCreator; import foundation.identity.jsonld.JsonLDUtils; public class W3CVerifiableCredentialDM2 extends com.danubetech.verifiablecredentials.VerifiableCredential { 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 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)); } public Date getValidUntil() { return JsonLDUtils.stringToDate(JsonLDUtils.jsonLdGetString(this.getJsonObject(), JSONLD_TERM_VALIDUNTIL)); } - private static final String JSONLD_TERM_VALIDFROM = "validFrom"; private static final String JSONLD_TERM_VALIDUNTIL = "validUntil";