001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package gov.nist.secauto.metaschema.databind.model; 007 008import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior; 009import gov.nist.secauto.metaschema.core.model.XmlGroupAsBehavior; 010 011import javax.xml.namespace.QName; 012 013import edu.umd.cs.findbugs.annotations.NonNull; 014import edu.umd.cs.findbugs.annotations.Nullable; 015 016/** 017 * A data object to record the group as selections. 018 */ 019public interface IGroupAs { 020 @NonNull 021 IGroupAs SINGLETON_GROUP_AS = new IGroupAs() { 022 @Override 023 public QName getGroupAsQName() { 024 return null; 025 } 026 027 @Override 028 public JsonGroupAsBehavior getJsonGroupAsBehavior() { 029 return JsonGroupAsBehavior.NONE; 030 } 031 032 @Override 033 public XmlGroupAsBehavior getXmlGroupAsBehavior() { 034 return XmlGroupAsBehavior.UNGROUPED; 035 } 036 }; 037 038 @Nullable 039 QName getGroupAsQName(); 040 041 @Nullable 042 default String getGroupAsName() { 043 QName qname = getGroupAsQName(); 044 return qname == null ? null : qname.getLocalPart(); 045 } 046 047 @Nullable 048 default String getGroupAsXmlNamespace() { 049 QName qname = getGroupAsQName(); 050 return qname == null ? null : qname.getNamespaceURI(); 051 } 052 053 @NonNull 054 JsonGroupAsBehavior getJsonGroupAsBehavior(); 055 056 @NonNull 057 XmlGroupAsBehavior getXmlGroupAsBehavior(); 058}