1
2
3
4
5
6 package gov.nist.secauto.metaschema.databind.model;
7
8 import gov.nist.secauto.metaschema.core.model.IBoundObject;
9 import gov.nist.secauto.metaschema.core.model.INamedModelInstanceGrouped;
10 import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
11 import gov.nist.secauto.metaschema.core.model.util.ModuleUtils;
12 import gov.nist.secauto.metaschema.core.util.ObjectUtils;
13 import gov.nist.secauto.metaschema.databind.io.BindingException;
14 import gov.nist.secauto.metaschema.databind.model.info.IFeatureComplexItemValueHandler;
15
16 import edu.umd.cs.findbugs.annotations.Nullable;
17
18
19
20
21 public interface IBoundInstanceModelGroupedNamed
22 extends INamedModelInstanceGrouped, IFeatureComplexItemValueHandler {
23 @Override
24 IBoundInstanceModelChoiceGroup getParentContainer();
25
26 @Override
27 IBoundDefinitionModelComplex getDefinition();
28
29 @Override
30 @Nullable
31 default IBoundInstanceFlag getEffectiveJsonKey() {
32 return JsonGroupAsBehavior.KEYED.equals(getParentContainer().getJsonGroupAsBehavior())
33 ? getJsonKey()
34 : null;
35 }
36
37 @Override
38 default IBoundInstanceFlag getJsonKey() {
39 String name = getParentContainer().getJsonKeyFlagInstanceName();
40 return name == null
41 ? null
42 : ObjectUtils.requireNonNull(
43 getDefinition().getFlagInstanceByName(
44 ModuleUtils.parseFlagName(getContainingModule(), name).getIndexPosition()));
45 }
46
47 @Override
48 default IBoundDefinitionModelAssembly getContainingDefinition() {
49 return getParentContainer().getContainingDefinition();
50 }
51
52 @Override
53 default String getName() {
54 return getDefinition().getName();
55 }
56
57 @Override
58 default IBoundObject deepCopyItem(IBoundObject item, IBoundObject parentInstance) throws BindingException {
59 return getDefinition().deepCopyItem(item, parentInstance);
60 }
61
62 @Override
63 default void callBeforeDeserialize(IBoundObject targetObject, IBoundObject parentObject) throws BindingException {
64 getDefinition().callBeforeDeserialize(targetObject, parentObject);
65 }
66
67 @Override
68 default void callAfterDeserialize(IBoundObject targetObject, IBoundObject parentObject) throws BindingException {
69 getDefinition().callAfterDeserialize(targetObject, parentObject);
70 }
71 }