001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.databind.io;
007
008import gov.nist.secauto.metaschema.core.model.IBoundObject;
009import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelComplex;
010import gov.nist.secauto.metaschema.databind.model.IBoundProperty;
011
012import java.io.IOException;
013import java.util.Collection;
014
015import edu.umd.cs.findbugs.annotations.NonNull;
016
017/**
018 * Implementations support handling common parsing issues.
019 */
020// TODO: consider what methods can be defined here
021public interface IProblemHandler {
022  /**
023   * A callback used to handle bound properties for which no data was found when
024   * the content was parsed.
025   * <p>
026   * This can be used to supply default or prescribed values based on application
027   * logic.
028   *
029   * @param parentDefinition
030   *          the bound class on which the missing properties are found
031   * @param targetObject
032   *          the Java object for the {@code parentDefinition}
033   * @param unhandledInstances
034   *          the set of instances that had no data to parse
035   * @throws IOException
036   *           if an error occurred while handling the missing instances
037   */
038  void handleMissingInstances(
039      @NonNull IBoundDefinitionModelComplex parentDefinition,
040      @NonNull IBoundObject targetObject,
041      @NonNull Collection<? extends IBoundProperty<?>> unhandledInstances)
042      throws IOException;
043}