Update the license for 2017-2018 license
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / introspection / MarshallerProperties.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-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 package org.onap.aai.introspection;
21
22 import org.onap.aai.restcore.MediaType;
23
24 public class MarshallerProperties {
25
26         private final MediaType type;
27         private final boolean includeRoot;
28         private final boolean wrapperAsArrayName;
29         private final boolean formatted;
30         
31         /**
32          * Instantiates a new marshaller properties.
33          *
34          * @param builder the builder
35          */
36         private MarshallerProperties(Builder builder) {
37                 
38                 this.type = builder.type;
39                 this.includeRoot = builder.includeRoot;
40                 this.wrapperAsArrayName = builder.wrapperAsArrayName;
41                 this.formatted = builder.formatted;
42         }
43         
44         /**
45          * Gets the media type.
46          *
47          * @return the media type
48          */
49         public MediaType getMediaType() {
50                 return this.type;
51         }
52         
53         /**
54          * Gets the include root.
55          *
56          * @return the include root
57          */
58         public boolean getIncludeRoot() {
59                 return this.includeRoot;
60         }
61         
62         /**
63          * Gets the wrapper as array name.
64          *
65          * @return the wrapper as array name
66          */
67         public boolean getWrapperAsArrayName() {
68                 return this.wrapperAsArrayName;
69         }
70         
71         /**
72          * Gets the formatted.
73          *
74          * @return the formatted
75          */
76         public boolean getFormatted() {
77                 return this.formatted;
78         }
79         
80         public static class Builder {
81                 
82                 private final MediaType type;
83                 private boolean includeRoot = false;
84                 private boolean wrapperAsArrayName = true;
85                 private boolean formatted = false;
86                 
87                 /**
88                  * Instantiates a new builder.
89                  *
90                  * @param type the type
91                  */
92                 public Builder(MediaType type) {
93                         this.type = type;
94                 }
95                 
96                 /**
97                  * Include root.
98                  *
99                  * @param includeRoot the include root
100                  * @return the builder
101                  */
102                 public Builder includeRoot (boolean includeRoot) {
103                         this.includeRoot = includeRoot;
104                         return this;
105                 }
106                 
107                 /**
108                  * Wrapper as array name.
109                  *
110                  * @param wrapperAsArrayName the wrapper as array name
111                  * @return the builder
112                  */
113                 public Builder wrapperAsArrayName (boolean wrapperAsArrayName) {
114                         this.wrapperAsArrayName = wrapperAsArrayName;
115                         return this;
116                 }
117                 
118                 /**
119                  * Formatted.
120                  *
121                  * @param formatted the formatted
122                  * @return the builder
123                  */
124                 public Builder formatted (boolean formatted) {
125                         this.formatted = formatted;
126                         return this;
127                 }
128                 
129                 /**
130                  * Builds the properties.
131                  *
132                  * @return the marshaller properties
133                  */
134                 public MarshallerProperties build() {
135                         return new MarshallerProperties(this);
136                 }
137         }
138 }