001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.databind.model.info;
007
008import java.io.IOException;
009import java.util.List;
010import java.util.Map;
011
012import edu.umd.cs.findbugs.annotations.NonNull;
013
014public interface IModelInstanceWriteHandler<ITEM> {
015  default void writeSingleton(@NonNull ITEM item) throws IOException {
016    writeItem(item);
017  }
018
019  void writeList(@NonNull List<ITEM> items) throws IOException;
020
021  void writeMap(@NonNull Map<String, ITEM> items) throws IOException;
022
023  /**
024   * Write the next item in the collection of items represented by the instance.
025   *
026   * @param item
027   *          the item Java object to write
028   * @throws IOException
029   *           if an error occurred while parsing the input
030   */
031  void writeItem(@NonNull ITEM item) throws IOException;
032}