Package ca.uhn.fhir.parser
Class StrictErrorHandler
- java.lang.Object
-
- ca.uhn.fhir.parser.StrictErrorHandler
-
- All Implemented Interfaces:
IParserErrorHandler
public class StrictErrorHandler extends Object implements IParserErrorHandler
Parser error handler which throws aDataFormatExceptionany time an issue is found while parsing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ca.uhn.fhir.parser.IParserErrorHandler
IParserErrorHandler.IParseLocation
-
-
Constructor Summary
Constructors Constructor Description StrictErrorHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontainedResourceWithNoId(IParserErrorHandler.IParseLocation theLocation)Invoked when a contained resource is parsed that has no ID specified (and is therefore invalid)voidextensionContainsValueAndNestedExtensions(IParserErrorHandler.IParseLocation theLocation)An extension contains both a value and at least one nested extensionvoidincorrectJsonType(IParserErrorHandler.IParseLocation theLocation, String theElementName, JsonLikeValue.ValueType theExpected, JsonLikeValue.ScalarType theExpectedScalarType, JsonLikeValue.ValueType theFound, JsonLikeValue.ScalarType theFoundScalarType)Invoked if the wrong type of element is found while parsing JSON.voidinvalidValue(IParserErrorHandler.IParseLocation theLocation, String theValue, String theError)The parser detected an attribute value that was invalid (such as: empty "" values are not permitted)voidmissingRequiredElement(IParserErrorHandler.IParseLocation theLocation, String theElementName)Resource was missing a required elementvoidunexpectedRepeatingElement(IParserErrorHandler.IParseLocation theLocation, String theElementName)Invoked when an element repetition (e.g.voidunknownAttribute(IParserErrorHandler.IParseLocation theLocation, String theAttributeName)Invoked when an unknown element is found in the document.voidunknownElement(IParserErrorHandler.IParseLocation theLocation, String theElementName)Invoked when an unknown element is found in the document.voidunknownReference(IParserErrorHandler.IParseLocation theLocation, String theReference)Resource contained a reference that could not be resolved and needs to be resolvable (e.g.
-
-
-
Constructor Detail
-
StrictErrorHandler
public StrictErrorHandler()
-
-
Method Detail
-
containedResourceWithNoId
public void containedResourceWithNoId(IParserErrorHandler.IParseLocation theLocation)
Description copied from interface:IParserErrorHandlerInvoked when a contained resource is parsed that has no ID specified (and is therefore invalid)- Specified by:
containedResourceWithNoIdin interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. WILL ALWAYS BE NULL currently, as this is not yet implemented, but this parameter is included so that locations can be added in the future without changing the API.
-
incorrectJsonType
public void incorrectJsonType(IParserErrorHandler.IParseLocation theLocation, String theElementName, JsonLikeValue.ValueType theExpected, JsonLikeValue.ScalarType theExpectedScalarType, JsonLikeValue.ValueType theFound, JsonLikeValue.ScalarType theFoundScalarType)
Description copied from interface:IParserErrorHandlerInvoked if the wrong type of element is found while parsing JSON. For example if a given element is expected to be a JSON Object and is a JSON array- Specified by:
incorrectJsonTypein interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theElementName- The name of the element that was found.theExpected- The datatype that was expected at this locationtheExpectedScalarType- If theExpectedValueType isJsonLikeValue.ValueType.SCALAR, this is the specific scalar type expected. Otherwise this parameter will be null.theFound- The datatype that was found at this locationtheFoundScalarType- If theFoundValueType isJsonLikeValue.ValueType.SCALAR, this is the specific scalar type found. Otherwise this parameter will be null.
-
invalidValue
public void invalidValue(IParserErrorHandler.IParseLocation theLocation, String theValue, String theError)
Description copied from interface:IParserErrorHandlerThe parser detected an attribute value that was invalid (such as: empty "" values are not permitted)- Specified by:
invalidValuein interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theValue- The actual valuetheError- A description of why the value was invalid
-
missingRequiredElement
public void missingRequiredElement(IParserErrorHandler.IParseLocation theLocation, String theElementName)
Description copied from interface:IParserErrorHandlerResource was missing a required element- Specified by:
missingRequiredElementin interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theElementName- The missing element name
-
unexpectedRepeatingElement
public void unexpectedRepeatingElement(IParserErrorHandler.IParseLocation theLocation, String theElementName)
Description copied from interface:IParserErrorHandlerInvoked when an element repetition (e.g. a second repetition of something) is found for a field which is non-repeating.- Specified by:
unexpectedRepeatingElementin interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theElementName- The name of the element that was found.
-
unknownAttribute
public void unknownAttribute(IParserErrorHandler.IParseLocation theLocation, String theAttributeName)
Description copied from interface:IParserErrorHandlerInvoked when an unknown element is found in the document.- Specified by:
unknownAttributein interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theAttributeName- The name of the attribute that was found.
-
unknownElement
public void unknownElement(IParserErrorHandler.IParseLocation theLocation, String theElementName)
Description copied from interface:IParserErrorHandlerInvoked when an unknown element is found in the document.- Specified by:
unknownElementin interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theElementName- The name of the element that was found.
-
unknownReference
public void unknownReference(IParserErrorHandler.IParseLocation theLocation, String theReference)
Description copied from interface:IParserErrorHandlerResource contained a reference that could not be resolved and needs to be resolvable (e.g. because it is a local reference to an unknown contained resource)- Specified by:
unknownReferencein interfaceIParserErrorHandler- Parameters:
theLocation- The location in the document. Note that this may benullas the ParseLocation feature is experimental. Use with caution, as the API may change.theReference- The actual invalid reference (e.g. "#3")
-
extensionContainsValueAndNestedExtensions
public void extensionContainsValueAndNestedExtensions(IParserErrorHandler.IParseLocation theLocation)
Description copied from interface:IParserErrorHandlerAn extension contains both a value and at least one nested extension- Specified by:
extensionContainsValueAndNestedExtensionsin interfaceIParserErrorHandler
-
-