
Package ca.uhn.fhir.rest.api
Enum EncodingEnum
- java.lang.Object
-
- java.lang.Enum<EncodingEnum>
-
- ca.uhn.fhir.rest.api.EncodingEnum
-
- All Implemented Interfaces:
Serializable
,Comparable<EncodingEnum>
public enum EncodingEnum extends Enum<EncodingEnum>
-
-
Field Summary
Fields Modifier and Type Field Description static String
JSON_PLAIN_STRING
"json"static String
RDF_PLAIN_STRING
"rdf"static String
XML_PLAIN_STRING
"xml"
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static EncodingEnum
detectEncoding(String theBody)
static EncodingEnum
detectEncodingNoDefault(String theBody)
static EncodingEnum
forContentType(String theContentType)
Returns the encoding for a given content type, ornull
if no encoding is found.static EncodingEnum
forContentTypeStrict(String theContentType)
Returns the encoding for a given content type, ornull
if no encoding is found.String
getFormatContentType()
Returnsxml
orjson
as used on the_format
search parameterString
getResourceContentType()
Will return application/xml+fhir styleString
getResourceContentTypeNonLegacy()
Will return application/fhir+xml stylestatic boolean
isLegacy(String theContentType)
Is the given type a FHIR legacy (pre-DSTU3) content type?abstract IParser
newParser(FhirContext theContext)
static EncodingEnum
valueOf(String name)
Returns the enum constant of this type with the specified name.static EncodingEnum[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JSON
public static final EncodingEnum JSON
-
XML
public static final EncodingEnum XML
-
RDF
public static final EncodingEnum RDF
-
-
Field Detail
-
JSON_PLAIN_STRING
public static final String JSON_PLAIN_STRING
"json"- See Also:
- Constant Field Values
-
RDF_PLAIN_STRING
public static final String RDF_PLAIN_STRING
"rdf"- See Also:
- Constant Field Values
-
XML_PLAIN_STRING
public static final String XML_PLAIN_STRING
"xml"- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static EncodingEnum[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EncodingEnum c : EncodingEnum.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EncodingEnum valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getFormatContentType
public String getFormatContentType()
Returnsxml
orjson
as used on the_format
search parameter
-
getResourceContentType
public String getResourceContentType()
Will return application/xml+fhir style
-
getResourceContentTypeNonLegacy
public String getResourceContentTypeNonLegacy()
Will return application/fhir+xml style
-
newParser
public abstract IParser newParser(FhirContext theContext)
-
detectEncoding
public static EncodingEnum detectEncoding(String theBody)
-
detectEncodingNoDefault
public static EncodingEnum detectEncodingNoDefault(String theBody)
-
forContentType
public static EncodingEnum forContentType(String theContentType)
Returns the encoding for a given content type, ornull
if no encoding is found.This method is lenient! Things like "application/xml" will return
XML
even if the "+fhir" part is missing from the expected content type. Also, spaces are treated as a plus (i.e. "application/fhir json" will be treated as "application/fhir+json" in order to account for unescaped spaces in URL parameters)
-
forContentTypeStrict
public static EncodingEnum forContentTypeStrict(String theContentType)
Returns the encoding for a given content type, ornull
if no encoding is found.This method is NOT lenient! Things like "application/xml" will return
null
- See Also:
forContentType(String)
-
-