Module dev.metaschema.databind
Package dev.metaschema.databind.io.xml
Class DefaultXmlProblemHandler
java.lang.Object
dev.metaschema.databind.io.AbstractProblemHandler
dev.metaschema.databind.io.xml.DefaultXmlProblemHandler
- All Implemented Interfaces:
IProblemHandler,IXmlProblemHandler
Handles problems identified in the parsed XML.
The default problem handler will report unknown attributes, and provide empty collections for multi-valued model items and default values for flags and single valued fields.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new problem handler with required field validation enabled.DefaultXmlProblemHandler(boolean validateRequiredFields) Construct a new problem handler with the specified validation setting. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleUnknownAttribute(IBoundDefinitionModelComplex parentDefinition, IBoundObject targetObject, Attribute attribute, IXmlParsingContext parsingContext) Callback used to handle an attribute that is unknown to the model being parsed.Methods inherited from class dev.metaschema.databind.io.AbstractProblemHandler
applyDefaults, handleMissingInstances, handleMissingInstances, isValidateRequiredFields, validateRequiredFieldsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.metaschema.databind.io.IProblemHandler
handleMissingInstances, handleMissingInstancesMethods inherited from interface dev.metaschema.databind.io.xml.IXmlProblemHandler
handleMissingFlagInstances, handleMissingFlagInstances, handleMissingModelInstances, handleMissingModelInstances, handleUnknownElement
-
Constructor Details
-
DefaultXmlProblemHandler
public DefaultXmlProblemHandler()Construct a new problem handler with required field validation enabled. -
DefaultXmlProblemHandler
public DefaultXmlProblemHandler(boolean validateRequiredFields) Construct a new problem handler with the specified validation setting.- Parameters:
validateRequiredFields-trueto validate that required fields are present,falseto skip validation
-
-
Method Details
-
handleUnknownAttribute
public boolean handleUnknownAttribute(IBoundDefinitionModelComplex parentDefinition, IBoundObject targetObject, Attribute attribute, IXmlParsingContext parsingContext) Description copied from interface:IXmlProblemHandlerCallback used to handle an attribute that is unknown to the model being parsed.- Specified by:
handleUnknownAttributein interfaceIXmlProblemHandler- Parameters:
parentDefinition- the bound class currently describing the data being parsedtargetObject- the Java object for theparentDefinitionattribute- the unknown attributeparsingContext- the XML parsing context used for parsing- Returns:
trueif the attribute was handled by this method, orfalseotherwise
-