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.databind.io.BindingException;
10 import gov.nist.secauto.metaschema.databind.model.info.IFeatureComplexItemValueHandler;
11
12 import java.lang.reflect.InvocationTargetException;
13 import java.lang.reflect.Method;
14 import java.util.Map;
15 import java.util.function.Predicate;
16
17 import edu.umd.cs.findbugs.annotations.NonNull;
18 import edu.umd.cs.findbugs.annotations.Nullable;
19
20
21
22
23 public interface IBoundDefinitionModelComplex
24 extends IBoundDefinitionModel<IBoundObject>, IFeatureComplexItemValueHandler {
25
26 @NonNull
27 Map<String, IBoundProperty<?>> getJsonProperties(@Nullable Predicate<IBoundInstanceFlag> flagFilter);
28
29 @Override
30 default boolean isInline() {
31 return getBoundClass().getEnclosingClass() != null;
32 }
33
34 @Nullable
35 Method getBeforeDeserializeMethod();
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 @Override
53 default void callBeforeDeserialize(IBoundObject targetObject, IBoundObject parentObject) throws BindingException {
54 Method beforeDeserializeMethod = getBeforeDeserializeMethod();
55 if (beforeDeserializeMethod != null) {
56 try {
57 beforeDeserializeMethod.invoke(targetObject, parentObject);
58 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
59 throw new BindingException(ex);
60 }
61 }
62 }
63
64 @Nullable
65 Method getAfterDeserializeMethod();
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 @Override
83 default void callAfterDeserialize(IBoundObject targetObject, IBoundObject parentObject) throws BindingException {
84 Method afterDeserializeMethod = getAfterDeserializeMethod();
85 if (afterDeserializeMethod != null) {
86 try {
87 afterDeserializeMethod.invoke(targetObject, parentObject);
88 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
89 throw new BindingException(ex);
90 }
91 }
92 }
93
94
95
96
97
98
99
100 }