001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.databind.io.json;
007
008import com.fasterxml.jackson.core.JsonParser;
009
010import gov.nist.secauto.metaschema.core.model.IBoundObject;
011import gov.nist.secauto.metaschema.databind.io.IProblemHandler;
012import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelComplex;
013
014import java.io.IOException;
015
016import edu.umd.cs.findbugs.annotations.NonNull;
017import edu.umd.cs.findbugs.annotations.Nullable;
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 parser
032   *          the JSON reader 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 JsonParser parser) throws IOException;
043}