1 /*
2 * SPDX-FileCopyrightText: none
3 * SPDX-License-Identifier: CC0-1.0
4 */
5
6 package gov.nist.secauto.metaschema.databind.io.json;
7
8 import gov.nist.secauto.metaschema.core.model.IBoundObject;
9 import gov.nist.secauto.metaschema.databind.io.IProblemHandler;
10 import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelComplex;
11
12 import java.io.IOException;
13
14 import edu.umd.cs.findbugs.annotations.NonNull;
15 import edu.umd.cs.findbugs.annotations.Nullable;
16
17 /**
18 * Handles common issues resulting from parsing JSON content.
19 */
20 public interface IJsonProblemHandler extends IProblemHandler {
21
22 /**
23 * Callback used to handle a JSON property that is unknown to the model being
24 * parsed.
25 *
26 * @param definition
27 * the bound class currently describing the data being parsed
28 * @param parentItem
29 * the Java object for the {@code parentDefinition}
30 * @param fieldName
31 * the unknown JSON field name
32 * @param parsingContext
33 * the JSON parsing context used for parsing
34 * @return {@code true} if the attribute was handled by this method, or
35 * {@code false} otherwise
36 * @throws IOException
37 * if an error occurred while handling the unrecognized data
38 */
39 boolean handleUnknownProperty(
40 @NonNull IBoundDefinitionModelComplex definition,
41 @Nullable IBoundObject parentItem,
42 @NonNull String fieldName,
43 @NonNull IJsonParsingContext parsingContext) throws IOException;
44 }