001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.databind.model.info;
007
008import gov.nist.secauto.metaschema.core.model.IBoundObject;
009import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelAssembly;
010import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelFieldComplex;
011import gov.nist.secauto.metaschema.databind.model.IBoundFieldValue;
012import gov.nist.secauto.metaschema.databind.model.IBoundInstanceFlag;
013import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelAssembly;
014import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelChoiceGroup;
015import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelFieldComplex;
016import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelFieldScalar;
017import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelGroupedAssembly;
018import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelGroupedField;
019
020import java.io.IOException;
021
022import edu.umd.cs.findbugs.annotations.NonNull;
023import edu.umd.cs.findbugs.annotations.Nullable;
024
025public interface IItemReadHandler {
026  /**
027   * Parse and return an item.
028   *
029   * @param parent
030   *          the parent Java object to use for serialization callbacks
031   * @param instance
032   *          the flag instance
033   * @return the Java object representing the parsed item
034   * @throws IOException
035   *           if an error occurred while parsing
036   */
037  @NonNull
038  Object readItemFlag(
039      @NonNull IBoundObject parent,
040      @NonNull IBoundInstanceFlag instance) throws IOException;
041
042  /**
043   * Parse and return an item.
044   *
045   * @param parent
046   *          the parent Java object to use for serialization callbacks
047   * @param instance
048   *          the field instance
049   * @return the Java object representing the parsed item
050   * @throws IOException
051   *           if an error occurred while parsing
052   */
053  @Nullable
054  Object readItemField(
055      @NonNull IBoundObject parent,
056      @NonNull IBoundInstanceModelFieldScalar instance) throws IOException;
057
058  /**
059   * Parse and return an item.
060   *
061   * @param parent
062   *          the parent Java object to use for serialization callbacks
063   * @param instance
064   *          the field instance
065   * @return the Java object representing the parsed item
066   * @throws IOException
067   *           if an error occurred while parsing
068   */
069  @NonNull
070  IBoundObject readItemField(
071      @NonNull IBoundObject parent,
072      @NonNull IBoundInstanceModelFieldComplex instance) throws IOException;
073
074  /**
075   * Parse and return an item.
076   *
077   * @param parent
078   *          the parent Java object to use for serialization callbacks
079   * @param instance
080   *          the field instance
081   * @return the Java object representing the parsed item
082   * @throws IOException
083   *           if an error occurred while parsing
084   */
085  @NonNull
086  IBoundObject readItemField(
087      @NonNull IBoundObject parent,
088      @NonNull IBoundInstanceModelGroupedField instance) throws IOException;
089
090  /**
091   * Parse and return an item.
092   *
093   * @param parent
094   *          the parent Java object to use for serialization callbacks, or
095   *          {@code null} if there is no parent
096   * @param definition
097   *          the field instance
098   * @return the Java object representing the parsed item
099   * @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}