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 @FunctionalInterface
22 public interface IProblemHandler {
23 /**
24 * A callback used to handle bound properties for which no data was found when
25 * the content was parsed.
26 * <p>
27 * This can be used to supply default or prescribed values based on application
28 * logic.
29 *
30 * @param parentDefinition
31 * the bound class on which the missing properties are found
32 * @param targetObject
33 * the Java object for the {@code parentDefinition}
34 * @param unhandledInstances
35 * the set of instances that had no data to parse
36 * @throws IOException
37 * if an error occurred while handling the missing instances
38 */
39 void handleMissingInstances(
40 @NonNull IBoundDefinitionModelComplex parentDefinition,
41 @NonNull IBoundObject targetObject,
42 @NonNull Collection<? extends IBoundProperty<?>> unhandledInstances)
43 throws IOException;
44 }