001package org.hl7.fhir.r4.formats;
002
003import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat;
004import org.hl7.fhir.r4.formats.IParser.OutputStyle;
005
006public class ParserFactory {
007
008  public static IParser parser(FhirFormat format) {
009    switch (format) {
010    case JSON : return new JsonParser();
011    case XML : return new XmlParser();
012    case TURTLE : return new RdfParser();
013    default:
014      throw new Error("Not supported at this time");
015    }
016  }
017
018  public static IParser parser(FhirFormat format, OutputStyle style) {
019    switch (format) {
020    case JSON : return new JsonParser().setOutputStyle(style);
021    case XML : return new XmlParser().setOutputStyle(style);
022    case TURTLE : return new RdfParser().setOutputStyle(style);
023    default:
024      throw new Error("Not supported at this time");
025    }
026  }
027  
028}