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 Details

  • 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 interface IProblemHandler
      Parameters:
      parentDefinition - the bound class on which the missing properties are found
      targetObject - the Java object for the parentDefinition
      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 provided unhandledInstances.
      Parameters:
      targetObject - the Java object to apply default values to
      unhandledInstances - the collection of unhandled instances to assign default values for
      Throws:
      IOException - if an error occurred while determining the default value for an instance