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