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=========================================================
21 package org.onap.aai.introspection;
23 import org.onap.aai.restcore.MediaType;
25 public class MarshallerProperties {
27 private final MediaType type;
28 private final boolean includeRoot;
29 private final boolean wrapperAsArrayName;
30 private final boolean formatted;
33 * Instantiates a new marshaller properties.
35 * @param builder the builder
37 private MarshallerProperties(Builder builder) {
39 this.type = builder.type;
40 this.includeRoot = builder.includeRoot;
41 this.wrapperAsArrayName = builder.wrapperAsArrayName;
42 this.formatted = builder.formatted;
46 * Gets the media type.
48 * @return the media type
50 public MediaType getMediaType() {
55 * Gets the include root.
57 * @return the include root
59 public boolean getIncludeRoot() {
60 return this.includeRoot;
64 * Gets the wrapper as array name.
66 * @return the wrapper as array name
68 public boolean getWrapperAsArrayName() {
69 return this.wrapperAsArrayName;
75 * @return the formatted
77 public boolean getFormatted() {
78 return this.formatted;
81 public static class Builder {
83 private final MediaType type;
84 private boolean includeRoot = false;
85 private boolean wrapperAsArrayName = true;
86 private boolean formatted = false;
89 * Instantiates a new builder.
91 * @param type the type
93 public Builder(MediaType type) {
100 * @param includeRoot the include root
101 * @return the builder
103 public Builder includeRoot(boolean includeRoot) {
104 this.includeRoot = includeRoot;
109 * Wrapper as array name.
111 * @param wrapperAsArrayName the wrapper as array name
112 * @return the builder
114 public Builder wrapperAsArrayName(boolean wrapperAsArrayName) {
115 this.wrapperAsArrayName = wrapperAsArrayName;
122 * @param formatted the formatted
123 * @return the builder
125 public Builder formatted(boolean formatted) {
126 this.formatted = formatted;
131 * Builds the properties.
133 * @return the marshaller properties
135 public MarshallerProperties build() {
136 return new MarshallerProperties(this);