2 * ================================================================================
3 * DCAE DMaaP Bus Controller REST Client
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
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 * ================================================================================
20 package org.openecomp.dcae.dmaapbc.client;
23 * Holds the status code and body that result from accessing an HTTP URL.
25 public class HttpStatusAndResponse<ResponseType> {
27 private int statusCode;
28 private ResponseType response;
30 public HttpStatusAndResponse(int status, ResponseType resp) {
31 this.statusCode = status;
35 public int getStatusCode() {
39 public void setStatusCode(final int code) {
40 this.statusCode = code;
43 public ResponseType getResponse() {
47 public void setResponse(ResponseType response) {
48 this.response = response;
52 * Convenience method to avoid testing for null and calling .toString()
54 * @return String version of the response object; null if the object is
57 public String getResponseString() {
58 return response == null ? null : response.toString();
62 public String toString() {
63 return "HttpStatusAndResponse[" + Integer.toString(statusCode) + ";"
64 + (response == null ? "" : response.toString()) + "]";