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