2 * ============LICENSE_START=======================================================
3 * PNF-REGISTRATION-HANDLER
4 * ================================================================================
5 * Copyright (C) 2018 NOKIA 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.dcaegen2.services.prh.response;
22 import static java.util.Collections.unmodifiableList;
24 import java.util.Collections;
25 import java.util.List;
26 import java.util.Optional;
27 import java.util.StringJoiner;
28 import org.springframework.lang.NonNull;
29 import org.springframework.lang.Nullable;
32 * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/17/18
34 public class DMaaPConsumerResponseImpl implements DMaaPConsumerResponse {
37 private final Integer responseCode;
38 private final String responseMessage;
39 private final List<String> fetchedMessage;
41 public DMaaPConsumerResponseImpl(@NonNull Integer responseCode, @NonNull String responseMessage,
42 @Nullable List<String> fetchedMessage) {
43 this.responseCode = responseCode;
44 this.responseMessage = responseMessage;
45 this.fetchedMessage = Optional.ofNullable(fetchedMessage).orElse(Collections.emptyList());
50 public String getResponseMessage() {
51 return responseMessage;
55 public Integer getResponseCode() {
60 public List<String> getFetchedMessages() {
61 return unmodifiableList(fetchedMessage);
65 public String toString() {
66 return new StringJoiner(", ", this.getClass().getSimpleName() + "[", "]")
67 .add("responseCode=" + responseCode)
68 .add("responseMessage=" + responseMessage)
69 .add("fetchedMessage=" + fetchedMessage)