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 gov.nist.secauto.metaschema.core.model.IBoundObject;
9   import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelAssembly;
10  import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelFieldComplex;
11  import gov.nist.secauto.metaschema.databind.model.IBoundFieldValue;
12  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceFlag;
13  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelAssembly;
14  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelChoiceGroup;
15  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelFieldComplex;
16  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelFieldScalar;
17  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelGroupedAssembly;
18  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelGroupedField;
19  
20  import java.io.IOException;
21  
22  import edu.umd.cs.findbugs.annotations.NonNull;
23  import edu.umd.cs.findbugs.annotations.Nullable;
24  
25  public interface IItemReadHandler {
26    /**
27     * Parse and return an item.
28     *
29     * @param parent
30     *          the parent Java object to use for serialization callbacks
31     * @param instance
32     *          the flag instance
33     * @return the Java object representing the parsed item
34     * @throws IOException
35     *           if an error occurred while parsing
36     */
37    @NonNull
38    Object readItemFlag(
39        @NonNull IBoundObject parent,
40        @NonNull IBoundInstanceFlag instance) throws IOException;
41  
42    /**
43     * Parse and return an item.
44     *
45     * @param parent
46     *          the parent Java object to use for serialization callbacks
47     * @param instance
48     *          the field instance
49     * @return the Java object representing the parsed item
50     * @throws IOException
51     *           if an error occurred while parsing
52     */
53    @Nullable
54    Object readItemField(
55        @NonNull IBoundObject parent,
56        @NonNull IBoundInstanceModelFieldScalar instance) throws IOException;
57  
58    /**
59     * Parse and return an item.
60     *
61     * @param parent
62     *          the parent Java object to use for serialization callbacks
63     * @param instance
64     *          the field instance
65     * @return the Java object representing the parsed item
66     * @throws IOException
67     *           if an error occurred while parsing
68     */
69    @NonNull
70    IBoundObject readItemField(
71        @NonNull IBoundObject parent,
72        @NonNull IBoundInstanceModelFieldComplex instance) throws IOException;
73  
74    /**
75     * Parse and return an item.
76     *
77     * @param parent
78     *          the parent Java object to use for serialization callbacks
79     * @param instance
80     *          the field instance
81     * @return the Java object representing the parsed item
82     * @throws IOException
83     *           if an error occurred while parsing
84     */
85    @NonNull
86    IBoundObject readItemField(
87        @NonNull IBoundObject parent,
88        @NonNull IBoundInstanceModelGroupedField instance) throws IOException;
89  
90    /**
91     * Parse and return an item.
92     *
93     * @param parent
94     *          the parent Java object to use for serialization callbacks, or
95     *          {@code null} if there is no parent
96     * @param definition
97     *          the field instance
98     * @return the Java object representing the parsed item
99     * @throws IOException
100    *           if an error occurred while parsing
101    */
102   @NonNull
103   IBoundObject readItemField(
104       @Nullable IBoundObject parent,
105       @NonNull IBoundDefinitionModelFieldComplex definition) throws IOException;
106 
107   /**
108    * Parse and return an item.
109    *
110    * @param parent
111    *          the parent Java object to use for serialization callbacks
112    * @param fieldValue
113    *          the field value instance
114    * @return the Java object representing the parsed item
115    * @throws IOException
116    *           if an error occurred while parsing
117    */
118   @Nullable
119   Object readItemFieldValue(
120       @NonNull IBoundObject parent,
121       @NonNull IBoundFieldValue fieldValue) throws IOException;
122 
123   /**
124    * Parse and return an item.
125    *
126    * @param parent
127    *          the parent Java object to use for serialization callbacks
128    * @param instance
129    *          the assembly instance
130    * @return the Java object representing the parsed item
131    * @throws IOException
132    *           if an error occurred while parsing
133    */
134   @NonNull
135   IBoundObject readItemAssembly(
136       @NonNull IBoundObject parent,
137       @NonNull IBoundInstanceModelAssembly instance) throws IOException;
138 
139   /**
140    * Parse and return an item.
141    *
142    * @param parent
143    *          the parent Java object to use for serialization callbacks
144    * @param instance
145    *          the assembly instance
146    * @return the Java object representing the parsed item
147    * @throws IOException
148    *           if an error occurred while parsing
149    */
150   @NonNull
151   IBoundObject readItemAssembly(
152       @NonNull IBoundObject parent,
153       @NonNull IBoundInstanceModelGroupedAssembly instance) throws IOException;
154 
155   /**
156    * Parse and return an item.
157    *
158    * @param parent
159    *          the parent Java object to use for serialization callbacks, or
160    *          {@code null} if there is no parent
161    * @param definition
162    *          the assembly instance
163    * @return the Java object representing the parsed item
164    * @throws IOException
165    *           if an error occurred while parsing
166    */
167   @NonNull
168   IBoundObject readItemAssembly(
169       @Nullable IBoundObject parent,
170       @NonNull IBoundDefinitionModelAssembly definition) throws IOException;
171 
172   /**
173    * Parse and return an item.
174    *
175    * @param parent
176    *          the parent Java object to use for serialization callbacks
177    * @param instance
178    *          the choice group instance
179    * @return the Java object representing the parsed item
180    * @throws IOException
181    *           if an error occurred while parsing
182    */
183   @Nullable
184   IBoundObject readChoiceGroupItem(
185       @NonNull IBoundObject parent,
186       @NonNull IBoundInstanceModelChoiceGroup instance) throws IOException;
187 }