Class AbstractProblemHandler
java.lang.Object
gov.nist.secauto.metaschema.databind.io.AbstractProblemHandler
- All Implemented Interfaces:
IProblemHandler
- Direct Known Subclasses:
DefaultJsonProblemHandler
,DefaultXmlProblemHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static void
applyDefaults
(Object targetObject, Collection<? extends IBoundProperty<?>> unhandledInstances) A utility method for applying default values for the providedunhandledInstances
.void
handleMissingInstances
(IBoundDefinitionModelComplex parentDefinition, IBoundObject targetObject, Collection<? extends IBoundProperty<?>> unhandledInstances) A callback used to handle bound properties for which no data was found when the content was parsed.
-
Constructor Details
-
AbstractProblemHandler
public AbstractProblemHandler()
-
-
Method Details
-
handleMissingInstances
public void handleMissingInstances(IBoundDefinitionModelComplex parentDefinition, IBoundObject targetObject, Collection<? extends IBoundProperty<?>> unhandledInstances) throws IOException Description copied from interface:IProblemHandler
A callback used to handle bound properties for which no data was found when the content was parsed.This can be used to supply default or prescribed values based on application logic.
- Specified by:
handleMissingInstances
in interfaceIProblemHandler
- Parameters:
parentDefinition
- the bound class on which the missing properties are foundtargetObject
- the Java object for theparentDefinition
unhandledInstances
- the set of instances that had no data to parse- Throws:
IOException
- if an error occurred while handling the missing instances
-
applyDefaults
protected static void applyDefaults(@NonNull Object targetObject, @NonNull Collection<? extends IBoundProperty<?>> unhandledInstances) throws IOException A utility method for applying default values for the providedunhandledInstances
.- Parameters:
targetObject
- the Java object to apply default values tounhandledInstances
- the collection of unhandled instances to assign default values for- Throws:
IOException
- if an error occurred while determining the default value for an instance
-