2 * ============LICENSE_START=======================================================
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
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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.introspection;
24 import org.onap.aai.restcore.MediaType;
26 public class MarshallerProperties {
28 private final MediaType type;
29 private final boolean includeRoot;
30 private final boolean wrapperAsArrayName;
31 private final boolean formatted;
34 * Instantiates a new marshaller properties.
36 * @param builder the builder
38 private MarshallerProperties(Builder builder) {
40 this.type = builder.type;
41 this.includeRoot = builder.includeRoot;
42 this.wrapperAsArrayName = builder.wrapperAsArrayName;
43 this.formatted = builder.formatted;
47 * Gets the media type.
49 * @return the media type
51 public MediaType getMediaType() {
56 * Gets the include root.
58 * @return the include root
60 public boolean getIncludeRoot() {
61 return this.includeRoot;
65 * Gets the wrapper as array name.
67 * @return the wrapper as array name
69 public boolean getWrapperAsArrayName() {
70 return this.wrapperAsArrayName;
76 * @return the formatted
78 public boolean getFormatted() {
79 return this.formatted;
82 public static class Builder {
84 private final MediaType type;
85 private boolean includeRoot = false;
86 private boolean wrapperAsArrayName = true;
87 private boolean formatted = false;
90 * Instantiates a new builder.
92 * @param type the type
94 public Builder(MediaType type) {
101 * @param includeRoot the include root
102 * @return the builder
104 public Builder includeRoot (boolean includeRoot) {
105 this.includeRoot = includeRoot;
110 * Wrapper as array name.
112 * @param wrapperAsArrayName the wrapper as array name
113 * @return the builder
115 public Builder wrapperAsArrayName (boolean wrapperAsArrayName) {
116 this.wrapperAsArrayName = wrapperAsArrayName;
123 * @param formatted the formatted
124 * @return the builder
126 public Builder formatted (boolean formatted) {
127 this.formatted = formatted;
132 * Builds the properties.
134 * @return the marshaller properties
136 public MarshallerProperties build() {
137 return new MarshallerProperties(this);