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.qname.IEnhancedQName;
10 import gov.nist.secauto.metaschema.core.util.ObjectUtils;
11 import gov.nist.secauto.metaschema.databind.io.BindingException;
12 import gov.nist.secauto.metaschema.databind.model.info.IFeatureScalarItemValueHandler;
13 import gov.nist.secauto.metaschema.databind.model.info.IItemReadHandler;
14 import gov.nist.secauto.metaschema.databind.model.info.IItemWriteHandler;
15
16 import java.io.IOException;
17
18 import edu.umd.cs.findbugs.annotations.NonNull;
19 import edu.umd.cs.findbugs.annotations.Nullable;
20
21 public interface IBoundFieldValue extends IFeatureScalarItemValueHandler, IBoundProperty<Object> {
22 @Override
23 @Nullable
24 Object getDefaultValue();
25
26
27
28
29
30
31 @NonNull
32 IBoundDefinitionModelFieldComplex getParentFieldDefinition();
33
34
35
36
37
38
39
40
41
42
43 @Nullable
44 String getJsonValueKeyFlagName();
45
46
47
48
49
50
51
52
53
54
55 @NonNull
56 String getJsonValueKeyName();
57
58 @Override
59 default Object getEffectiveDefaultValue() {
60 return getDefaultValue();
61 }
62
63 @Override
64 default Object readItem(IBoundObject parent, IItemReadHandler handler) throws IOException {
65 return handler.readItemFieldValue(ObjectUtils.requireNonNull(parent, "parent"), this);
66 }
67
68 @Override
69 default void writeItem(Object item, IItemWriteHandler handler) throws IOException {
70 handler.writeItemFieldValue(item, this);
71 }
72
73 @Override
74 default void deepCopy(@NonNull IBoundObject fromInstance, @NonNull IBoundObject toInstance) throws BindingException {
75 Object value = getValue(fromInstance);
76 if (value != null) {
77 setValue(toInstance, value);
78 }
79 }
80
81 @Override
82 default boolean canHandleXmlQName(IEnhancedQName qname) {
83
84 return getJavaTypeAdapter().canHandleQName(qname);
85 }
86
87 }