1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package gov.nist.secauto.metaschema.databind.io;
7
8 import gov.nist.secauto.metaschema.core.model.IBoundObject;
9 import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelComplex;
10 import gov.nist.secauto.metaschema.databind.model.IBoundProperty;
11
12 import java.io.IOException;
13 import java.util.Collection;
14
15 import edu.umd.cs.findbugs.annotations.NonNull;
16
17 /**
18 * Implementations support handling common parsing issues.
19 */
20 // TODO: consider what methods can be defined here
21 public interface IProblemHandler {
22 /**
23 * A callback used to handle bound properties for which no data was found when
24 * the content was parsed.
25 * <p>
26 * This can be used to supply default or prescribed values based on application
27 * logic.
28 *
29 * @param parentDefinition
30 * the bound class on which the missing properties are found
31 * @param targetObject
32 * the Java object for the {@code parentDefinition}
33 * @param unhandledInstances
34 * the set of instances that had no data to parse
35 * @throws IOException
36 * if an error occurred while handling the missing instances
37 */
38 void handleMissingInstances(
39 @NonNull IBoundDefinitionModelComplex parentDefinition,
40 @NonNull IBoundObject targetObject,
41 @NonNull Collection<? extends IBoundProperty<?>> unhandledInstances)
42 throws IOException;
43 }