Class AbstractProblemHandler
- java.lang.Object
-
- gov.nist.secauto.metaschema.databind.io.AbstractProblemHandler
-
- All Implemented Interfaces:
IProblemHandler
- Direct Known Subclasses:
DefaultJsonProblemHandler,DefaultXmlProblemHandler
public abstract class AbstractProblemHandler extends Object implements IProblemHandler
-
-
Constructor Summary
Constructors Constructor Description AbstractProblemHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static <TYPE extends IBoundNamedInstance>
voidapplyDefaults(Object targetObject, Collection<TYPE> unhandledInstances)A utility method for applying default values for the providedunhandledInstances.voidhandleMissingInstances(IClassBinding parentDefinition, Object targetObject, Collection<? extends IBoundNamedInstance> unhandledInstances)A callback used to handle bound properties for which no data was found when the content was parsed.
-
-
-
Constructor Detail
-
AbstractProblemHandler
public AbstractProblemHandler()
-
-
Method Detail
-
handleMissingInstances
public void handleMissingInstances(IClassBinding parentDefinition, Object targetObject, Collection<? extends IBoundNamedInstance> unhandledInstances) throws IOException
Description copied from interface:IProblemHandlerA 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:
handleMissingInstancesin interfaceIProblemHandler- Parameters:
parentDefinition- the bound class on which the missing properties are foundtargetObject- the Java object for theparentDefinitionunhandledInstances- the set of instances that had no data to parse- Throws:
IOException- if an error occurred while handling the missing instances
-
applyDefaults
protected static <TYPE extends IBoundNamedInstance> void applyDefaults(@NonNull Object targetObject, @NonNull Collection<TYPE> unhandledInstances) throws IOException
A utility method for applying default values for the providedunhandledInstances.- Type Parameters:
TYPE- the instance Java type to handle- 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
-
-