001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package dev.metaschema.databind.io.json;
007
008import java.io.IOException;
009
010import dev.metaschema.core.model.IBoundObject;
011import dev.metaschema.databind.io.IProblemHandler;
012import dev.metaschema.databind.model.IBoundDefinitionModelComplex;
013import edu.umd.cs.findbugs.annotations.NonNull;
014import edu.umd.cs.findbugs.annotations.Nullable;
015
016/**
017 * Handles common issues resulting from parsing JSON content.
018 */
019public interface IJsonProblemHandler extends IProblemHandler {
020
021  /**
022   * Callback used to handle a JSON property that is unknown to the model being
023   * parsed.
024   *
025   * @param definition
026   *          the bound class currently describing the data being parsed
027   * @param parentItem
028   *          the Java object for the {@code parentDefinition}
029   * @param fieldName
030   *          the unknown JSON field name
031   * @param parsingContext
032   *          the JSON parsing context used for parsing
033   * @return {@code true} if the attribute was handled by this method, or
034   *         {@code false} otherwise
035   * @throws IOException
036   *           if an error occurred while handling the unrecognized data
037   */
038  boolean handleUnknownProperty(
039      @NonNull IBoundDefinitionModelComplex definition,
040      @Nullable IBoundObject parentItem,
041      @NonNull String fieldName,
042      @NonNull IJsonParsingContext parsingContext) throws IOException;
043}