Enum Class EncodingType

java.lang.Object
java.lang.Enum<EncodingType>
de.gematik.bbriccs.fhir.EncodingType
All Implemented Interfaces:
Serializable, Comparable<EncodingType>, Constable

public enum EncodingType extends Enum<EncodingType>
The only Encodings we support for FHIR representation
  • Enum Constant Details

  • Method Details

    • values

      public static EncodingType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EncodingType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromString

      public static EncodingType fromString(String value)
    • flipEncoding

      public EncodingType flipEncoding()
    • toFileExtension

      public String toFileExtension()
    • chooseAppropriateParser

      public static ca.uhn.fhir.parser.IParser chooseAppropriateParser(String encoding, ca.uhn.fhir.parser.IParser xml, ca.uhn.fhir.parser.IParser json)
      Choose one of the two given parsers as a function of the given encoding as a String
      Parameters:
      encoding - defines which encoding to choose e.g. by a file extension like .xml or simply json
      xml - the XML Parser
      json - the JSON Parser
      Returns:
      either the XML or the JSON parser dependent of the given encoding
    • chooseAppropriateParser

      public ca.uhn.fhir.parser.IParser chooseAppropriateParser(ca.uhn.fhir.parser.IParser xml, ca.uhn.fhir.parser.IParser json)
      Choose one of the two given parsers as a function of the actual EncodingType
      Parameters:
      xml - the XML Parser
      json - the JSON Parser
      Returns:
      either the XML or the JSON parser depending on the actual EncodingType
    • chooseAppropriateParser

      public ca.uhn.fhir.parser.IParser chooseAppropriateParser(Supplier<ca.uhn.fhir.parser.IParser> xml, Supplier<ca.uhn.fhir.parser.IParser> json)
    • choose

      public <T> T choose(Supplier<T> xml, Supplier<T> json)
    • guessFromContent

      public static EncodingType guessFromContent(String content)
      Try to guess the encoding from the content itself. Use with caution as might be very unreliable in many cases!
      Parameters:
      content - the content which needs to be parsed
      Returns:
      XML if the content is empty or starts with the char < (indicating XML) and JSON otherwise