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