Module dev.metaschema.databind
Package dev.metaschema.databind.io.json
Class DefaultJsonProblemHandler
java.lang.Object
dev.metaschema.databind.io.AbstractProblemHandler
dev.metaschema.databind.io.json.DefaultJsonProblemHandler
- All Implemented Interfaces:
IProblemHandler,IJsonProblemHandler
public class DefaultJsonProblemHandler
extends AbstractProblemHandler
implements IJsonProblemHandler
This problem handler implementation handles common issues when parsing
JSON-based Metaschema module instances.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new problem handler with required field validation enabled.DefaultJsonProblemHandler(boolean validateRequiredFields) Construct a new problem handler with the specified validation setting. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleUnknownProperty(IBoundDefinitionModelComplex classBinding, IBoundObject targetObject, String fieldName, IJsonParsingContext parsingContext) Callback used to handle a JSON property 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, handleMissingInstances
-
Constructor Details
-
DefaultJsonProblemHandler
public DefaultJsonProblemHandler()Construct a new problem handler with required field validation enabled. -
DefaultJsonProblemHandler
public DefaultJsonProblemHandler(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
-
handleUnknownProperty
public boolean handleUnknownProperty(IBoundDefinitionModelComplex classBinding, IBoundObject targetObject, String fieldName, IJsonParsingContext parsingContext) throws IOException Description copied from interface:IJsonProblemHandlerCallback used to handle a JSON property that is unknown to the model being parsed.- Specified by:
handleUnknownPropertyin interfaceIJsonProblemHandler- Parameters:
classBinding- the bound class currently describing the data being parsedtargetObject- the Java object for theparentDefinitionfieldName- the unknown JSON field nameparsingContext- the JSON parsing context used for parsing- Returns:
trueif the attribute was handled by this method, orfalseotherwise- Throws:
IOException- if an error occurred while handling the unrecognized data
-