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    @Nullable
30    Method getBeforeDeserializeMethod();
31  
32    
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47    @Override
48    default void callBeforeDeserialize(IBoundObject targetObject, IBoundObject parentObject) throws BindingException {
49      Method beforeDeserializeMethod = getBeforeDeserializeMethod();
50      if (beforeDeserializeMethod != null) {
51        try {
52          beforeDeserializeMethod.invoke(targetObject, parentObject);
53        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
54          throw new BindingException(ex);
55        }
56      }
57    }
58  
59    @Nullable
60    Method getAfterDeserializeMethod();
61  
62    
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77    @Override
78    default void callAfterDeserialize(IBoundObject targetObject, IBoundObject parentObject) throws BindingException {
79      Method afterDeserializeMethod = getAfterDeserializeMethod();
80      if (afterDeserializeMethod != null) {
81        try {
82          afterDeserializeMethod.invoke(targetObject, parentObject);
83        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
84          throw new BindingException(ex);
85        }
86      }
87    }
88  
89    
90    
91    
92    
93    
94  
95  }