Class ChVacdParser

java.lang.Object
org.projecthusky.fhir.vacd.ch.common.service.ChVacdParser

@ThreadSafe public class ChVacdParser extends Object
Parser for CH-VACD documents.
  • Constructor Details

    • ChVacdParser

      public ChVacdParser(@Nullable ca.uhn.fhir.context.FhirContext fhirR4Context)
      Constructor for the parser.
  • Method Details

    • parse

      public <T extends ChVacdAbstractDocument> T parse(String resource, ChVacdDocumentType type)
      Parses the given resource as a CH-VACD document.
      Parameters:
      resource - The resource to parse.
      type - The document type to use for parsing.
      Returns:
      the parsed document.
      Throws:
      InvalidVacdContentException - if the content is invalid or not a CH-VACD document.
    • getParser

      protected ca.uhn.fhir.parser.IParser getParser(ca.uhn.fhir.rest.api.EncodingEnum encoding, @Nullable ChVacdDocumentType type)
      Creates a FHIR parser for the given encoding. If the document type is given, it'll also configure the preferred types for this document type (i.e. to use resources from org.projecthusky.fhir.emed.ch.common.resource and org.projecthusky.fhir.emed.ch.epr.resource over HAPI's resources).
      Parameters:
      encoding - The encoding to use (XML, JSON, NDJSON or RDF).
      type - The document type or null to disable the preferred types (not needed for serialization).
      Returns:
      the created parser.