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