Update project structure to org.onap.aaf
[aaf/inno.git] / rosetta / src / test / java / com / data / test / obj / SingleMarshal.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 package com.data.test.obj;\r
24 \r
25 import java.util.List;\r
26 \r
27 import javax.xml.datatype.XMLGregorianCalendar;\r
28 \r
29 import org.onap.aaf.rosetta.marshal.DataWriter;\r
30 import org.onap.aaf.rosetta.marshal.FieldArray;\r
31 import org.onap.aaf.rosetta.marshal.FieldDate;\r
32 import org.onap.aaf.rosetta.marshal.FieldDateTime;\r
33 import org.onap.aaf.rosetta.marshal.FieldHexBinary;\r
34 import org.onap.aaf.rosetta.marshal.FieldNumeric;\r
35 import org.onap.aaf.rosetta.marshal.FieldString;\r
36 import org.onap.aaf.rosetta.marshal.ObjMarshal;\r
37 \r
38 import types.xsd.Multi.Single;\r
39 \r
40 public class SingleMarshal extends ObjMarshal<Single> {\r
41         public SingleMarshal() {\r
42                 add(new FieldString<Single>("str") {\r
43                         @Override\r
44                         protected String data(Single t) {\r
45                                 return t.getStr();\r
46                         }\r
47                 });\r
48                 \r
49                 add(new FieldNumeric<Integer, Single>("int") {\r
50                         @Override\r
51                         protected Integer data(Single t) {\r
52                                 return t.getInt();\r
53                         }\r
54                 });\r
55                 \r
56                 add(new FieldNumeric<Long,Single>("long") {\r
57                         @Override\r
58                         protected Long data(Single t) {\r
59                                 return t.getLong();\r
60                         }\r
61                 });\r
62 \r
63                 add(new FieldDate<Single>("date") {\r
64                         @Override\r
65                         protected XMLGregorianCalendar data(Single t) {\r
66                                 return t.getDate();\r
67                         }\r
68                 });\r
69 \r
70                 add(new FieldDateTime<Single>("datetime") {\r
71                         @Override\r
72                         protected XMLGregorianCalendar data(Single t) {\r
73                                 return t.getDate();\r
74                         }\r
75                 });\r
76                 \r
77                 add(new FieldHexBinary<Single>("binary") {\r
78                         @Override\r
79                         protected byte[] data(Single t) {\r
80                                 return t.getBinary();\r
81                         }\r
82                 });\r
83                 \r
84                 add(new FieldArray<Single,String>("array", DataWriter.STRING) {\r
85                         @Override\r
86                         protected List<String> data(Single t) {\r
87                                 return t.getArray();\r
88                         }\r
89                 });\r
90 \r
91         }\r
92 }\r