001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package gov.nist.secauto.metaschema.databind.io; 007 008import gov.nist.secauto.metaschema.core.model.IBoundObject; 009import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelComplex; 010import gov.nist.secauto.metaschema.databind.model.IBoundProperty; 011 012import java.io.IOException; 013import java.util.Collection; 014 015import edu.umd.cs.findbugs.annotations.NonNull; 016 017/** 018 * Implementations support handling common parsing issues. 019 */ 020// TODO: consider what methods can be defined here 021@FunctionalInterface 022public interface IProblemHandler { 023 /** 024 * A callback used to handle bound properties for which no data was found when 025 * the content was parsed. 026 * <p> 027 * This can be used to supply default or prescribed values based on application 028 * logic. 029 * 030 * @param parentDefinition 031 * the bound class on which the missing properties are found 032 * @param targetObject 033 * the Java object for the {@code parentDefinition} 034 * @param unhandledInstances 035 * the set of instances that had no data to parse 036 * @throws IOException 037 * if an error occurred while handling the missing instances 038 */ 039 void handleMissingInstances( 040 @NonNull IBoundDefinitionModelComplex parentDefinition, 041 @NonNull IBoundObject targetObject, 042 @NonNull Collection<? extends IBoundProperty<?>> unhandledInstances) 043 throws IOException; 044}