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