1
2
3
4
5
6 package gov.nist.secauto.metaschema.databind.io;
7
8 import gov.nist.secauto.metaschema.core.model.IBoundObject;
9 import gov.nist.secauto.metaschema.databind.model.IBoundDefinitionModelComplex;
10 import gov.nist.secauto.metaschema.databind.model.info.IFeatureComplexItemValueHandler;
11
12 import java.io.IOException;
13
14 import edu.umd.cs.findbugs.annotations.NonNull;
15
16 public interface IWritingContext<WRITER> {
17
18
19
20
21
22 @NonNull
23 WRITER getWriter();
24
25
26
27
28
29
30
31
32
33
34
35
36 void write(
37 @NonNull IBoundDefinitionModelComplex definition,
38 @NonNull IBoundObject targetObject) throws IOException;
39
40 @FunctionalInterface
41 interface ObjectWriter<T extends IFeatureComplexItemValueHandler> {
42
43 void accept(@NonNull IBoundObject parentItem, @NonNull T handler) throws IOException;
44
45
46
47
48
49
50
51
52
53 @NonNull
54 default ObjectWriter<T> andThen(@NonNull ObjectWriter<? super T> after) {
55 return (parentItem, handler) -> {
56 accept(parentItem, handler);
57 after.accept(parentItem, handler);
58 };
59 }
60 }
61 }