1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.databind.model.impl;
7   
8   import gov.nist.secauto.metaschema.core.model.IBoundObject;
9   import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
10  import gov.nist.secauto.metaschema.core.model.XmlGroupAsBehavior;
11  import gov.nist.secauto.metaschema.databind.io.BindingException;
12  import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModel;
13  import gov.nist.secauto.metaschema.databind.model.IGroupAs;
14  
15  import edu.umd.cs.findbugs.annotations.NonNull;
16  
17  public interface IFeatureInstanceModelGroupAs<ITEM> extends IBoundInstanceModel<ITEM> {
18    @NonNull
19    IGroupAs getGroupAs();
20  
21    @Override
22    default String getGroupAsName() {
23      return getGroupAs().getGroupAsName();
24    }
25  
26    @Override
27    default String getGroupAsXmlNamespace() {
28      return getGroupAs().getGroupAsXmlNamespace();
29    }
30  
31    @Override
32    default JsonGroupAsBehavior getJsonGroupAsBehavior() {
33      return getGroupAs().getJsonGroupAsBehavior();
34    }
35  
36    @Override
37    default XmlGroupAsBehavior getXmlGroupAsBehavior() {
38      return getGroupAs().getXmlGroupAsBehavior();
39    }
40  
41    @Override
42    default void deepCopy(@NonNull IBoundObject fromInstance, @NonNull IBoundObject toInstance) throws BindingException {
43      Object value = getValue(fromInstance);
44      if (value != null) {
45        value = getCollectionInfo().deepCopyItems(fromInstance, toInstance);
46      }
47      setValue(toInstance, value);
48    }
49  }