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