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  import edu.umd.cs.findbugs.annotations.Nullable;
14  
15  public interface IModelInstanceReadHandler<ITEM> {
16    @Nullable
17    default ITEM readSingleton() throws IOException {
18      return readItem();
19    }
20  
21    @NonNull
22    List<ITEM> readList() throws IOException;
23  
24    @NonNull
25    Map<String, ITEM> readMap() throws IOException;
26  
27    /**
28     * Read the next item in the collection of items represented by the instance.
29     *
30     * @return the Java object representing the item, or {@code null} if no items
31     *         remain to be read
32     * @throws IOException
33     *           if an error occurred while parsing the input
34     */
35    ITEM readItem() throws IOException;
36  
37    @Nullable
38    String getJsonKeyFlagName();
39  }