1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.core.model;
7   
8   import edu.umd.cs.findbugs.annotations.NonNull;
9   
10  /**
11   * Represents a field instance that appears within a choice or other grouping
12   * construct.
13   * <p>
14   * Grouped field instances always have XML wrapping enabled and inherit
15   * cardinality from their containing group.
16   */
17  public interface IFieldInstanceGrouped extends INamedModelInstanceGrouped, IFieldInstance {
18  
19    /**
20     * Determines if the field is configured to have a wrapper in XML.
21     *
22     * @return {@code true} if an XML wrapper is required, or {@code false}
23     *         otherwise
24     */
25    @Override
26    default boolean isInXmlWrapped() {
27      // must always be wrapped
28      return true;
29    }
30  
31    @Override
32    default boolean isEffectiveValueWrappedInXml() {
33      // must always be wrapped
34      return true;
35    }
36  
37    /**
38     * A visitor callback.
39     *
40     * @param <CONTEXT>
41     *          the type of the context parameter
42     * @param <RESULT>
43     *          the type of the visitor result
44     * @param visitor
45     *          the calling visitor
46     * @param context
47     *          a parameter used to pass contextual information between visitors
48     * @return the visitor result
49     */
50    @Override
51    default <CONTEXT, RESULT> RESULT accept(@NonNull IModelElementVisitor<CONTEXT, RESULT> visitor, CONTEXT context) {
52      return visitor.visitFieldInstance(this, context);
53    }
54  }