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===========================================
21 package org.onap.dcae.apod.analytics.dmaap.domain.response;
23 import com.google.common.base.Objects;
24 import com.google.common.collect.ImmutableList;
26 import java.util.List;
28 import javax.annotation.Nonnull;
29 import javax.annotation.Nullable;
31 import static java.util.Collections.unmodifiableList;
35 * A simple implementation for {@link DMaaPMRSubscriberResponse}
37 * @author Rajiv Singla . Creation Date: 10/13/2016.
39 public class DMaaPMRSubscriberResponseImpl implements DMaaPMRSubscriberResponse {
41 private final Integer responseCode;
42 private final String responseMessage;
43 private final List<String> fetchedMessages;
45 public DMaaPMRSubscriberResponseImpl(@Nonnull Integer responseCode,
46 @Nonnull String responseMessage,
47 @Nullable List<String> fetchedMessages) {
48 this.responseCode = responseCode;
49 this.responseMessage = responseMessage;
50 this.fetchedMessages = fetchedMessages != null ? fetchedMessages : ImmutableList.<String>of();
53 public DMaaPMRSubscriberResponseImpl(Integer responseCode, String responseMessage) {
54 this(responseCode, responseMessage, null);
58 public Integer getResponseCode() {
63 public String getResponseMessage() {
64 return responseMessage;
68 public List<String> getFetchedMessages() {
69 return unmodifiableList(fetchedMessages);
73 public String toString() {
74 return Objects.toStringHelper(this)
75 .add("responseCode", responseCode)
76 .add("responseMessage", responseMessage)
77 .add("fetchedMessages(size)", fetchedMessages.size())