1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package gov.nist.secauto.metaschema.databind.model.test;
28
29 import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
30 import gov.nist.secauto.metaschema.core.model.XmlGroupAsBehavior;
31 import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
32 import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
33 import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
34 import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
35 import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaField;
36 import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaFieldValue;
37
38 import java.util.List;
39
40 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
41
42
43 @SuppressWarnings("PMD")
44 @MetaschemaAssembly(name = "test-field", moduleClass = TestMetaschema.class)
45 public class MultiFieldAssembly {
46 @BoundField
47 private String field1;
48
49 @BoundField(useName = "field2",
50 maxOccurs = -1)
51 @GroupAs(name = "fields2",
52 inXml = XmlGroupAsBehavior.GROUPED,
53 inJson = JsonGroupAsBehavior.LIST)
54 private List<String> _field2;
55
56 @BoundField
57 private ValueKeyField field3;
58
59 @BoundField
60 private DefaultValueKeyField field4;
61
62 public MultiFieldAssembly() {
63 }
64
65 public String getField1() {
66 return field1;
67 }
68
69 @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "this is a data holder")
70 public List<String> getField2() {
71 return _field2;
72 }
73
74 public ValueKeyField getField3() {
75 return field3;
76 }
77
78 public void setField3(ValueKeyField field3) {
79 this.field3 = field3;
80 }
81
82 public DefaultValueKeyField getField4() {
83 return field4;
84 }
85
86 public void setField4(DefaultValueKeyField field4) {
87 this.field4 = field4;
88 }
89
90 @SuppressWarnings("PMD")
91 @MetaschemaField(
92 name = "field-value-key",
93 moduleClass = TestMetaschema.class)
94 public static class ValueKeyField {
95 @BoundFlag
96 private String flag;
97
98 @MetaschemaFieldValue(valueKeyName = "a-value")
99 private String _value;
100
101 public ValueKeyField() {
102 }
103
104 public String getValue() {
105 return _value;
106 }
107 }
108
109 @SuppressWarnings("PMD")
110 @MetaschemaField(
111 name = "field-default-value-key",
112 moduleClass = TestMetaschema.class)
113 public static class DefaultValueKeyField {
114 @BoundFlag
115 private String flag;
116
117 @MetaschemaFieldValue
118 private String _value;
119
120 public DefaultValueKeyField() {
121 }
122
123 public String getValue() {
124 return _value;
125 }
126 }
127 }