2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.aai.introspection;
22 import org.onap.aai.restcore.MediaType;
24 public class MarshallerProperties {
26 private final MediaType type;
27 private final boolean includeRoot;
28 private final boolean wrapperAsArrayName;
29 private final boolean formatted;
32 * Instantiates a new marshaller properties.
34 * @param builder the builder
36 private MarshallerProperties(Builder builder) {
38 this.type = builder.type;
39 this.includeRoot = builder.includeRoot;
40 this.wrapperAsArrayName = builder.wrapperAsArrayName;
41 this.formatted = builder.formatted;
45 * Gets the media type.
47 * @return the media type
49 public MediaType getMediaType() {
54 * Gets the include root.
56 * @return the include root
58 public boolean getIncludeRoot() {
59 return this.includeRoot;
63 * Gets the wrapper as array name.
65 * @return the wrapper as array name
67 public boolean getWrapperAsArrayName() {
68 return this.wrapperAsArrayName;
74 * @return the formatted
76 public boolean getFormatted() {
77 return this.formatted;
80 public static class Builder {
82 private final MediaType type;
83 private boolean includeRoot = false;
84 private boolean wrapperAsArrayName = true;
85 private boolean formatted = false;
88 * Instantiates a new builder.
90 * @param type the type
92 public Builder(MediaType type) {
99 * @param includeRoot the include root
100 * @return the builder
102 public Builder includeRoot (boolean includeRoot) {
103 this.includeRoot = includeRoot;
108 * Wrapper as array name.
110 * @param wrapperAsArrayName the wrapper as array name
111 * @return the builder
113 public Builder wrapperAsArrayName (boolean wrapperAsArrayName) {
114 this.wrapperAsArrayName = wrapperAsArrayName;
121 * @param formatted the formatted
122 * @return the builder
124 public Builder formatted (boolean formatted) {
125 this.formatted = formatted;
130 * Builds the properties.
132 * @return the marshaller properties
134 public MarshallerProperties build() {
135 return new MarshallerProperties(this);