1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.databind.model.info;
7   
8   import java.io.IOException;
9   import java.util.List;
10  import java.util.Map;
11  
12  import edu.umd.cs.findbugs.annotations.NonNull;
13  
14  public interface IModelInstanceWriteHandler<ITEM> {
15    default void writeSingleton(@NonNull ITEM item) throws IOException {
16      writeItem(item);
17    }
18  
19    void writeList(@NonNull List<ITEM> items) throws IOException;
20  
21    void writeMap(@NonNull Map<String, ITEM> items) throws IOException;
22  
23    /**
24     * Write the next item in the collection of items represented by the instance.
25     *
26     * @param item
27     *          the item Java object to write
28     * @throws IOException
29     *           if an error occurred while parsing the input
30     */
31    void writeItem(@NonNull ITEM item) throws IOException;
32  }