1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.databind.model;
7   
8   import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
9   import gov.nist.secauto.metaschema.core.model.XmlGroupAsBehavior;
10  
11  import javax.xml.namespace.QName;
12  
13  import edu.umd.cs.findbugs.annotations.NonNull;
14  import edu.umd.cs.findbugs.annotations.Nullable;
15  
16  /**
17   * A data object to record the group as selections.
18   */
19  public interface IGroupAs {
20    @NonNull
21    IGroupAs SINGLETON_GROUP_AS = new IGroupAs() {
22      @Override
23      public QName getGroupAsQName() {
24        return null;
25      }
26  
27      @Override
28      public JsonGroupAsBehavior getJsonGroupAsBehavior() {
29        return JsonGroupAsBehavior.NONE;
30      }
31  
32      @Override
33      public XmlGroupAsBehavior getXmlGroupAsBehavior() {
34        return XmlGroupAsBehavior.UNGROUPED;
35      }
36    };
37  
38    @Nullable
39    QName getGroupAsQName();
40  
41    @Nullable
42    default String getGroupAsName() {
43      QName qname = getGroupAsQName();
44      return qname == null ? null : qname.getLocalPart();
45    }
46  
47    @Nullable
48    default String getGroupAsXmlNamespace() {
49      QName qname = getGroupAsQName();
50      return qname == null ? null : qname.getNamespaceURI();
51    }
52  
53    @NonNull
54    JsonGroupAsBehavior getJsonGroupAsBehavior();
55  
56    @NonNull
57    XmlGroupAsBehavior getXmlGroupAsBehavior();
58  }