2 * ===============LICENSE_START=======================================================
4 * ===================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property & Tech Mahindra. All rights reserved.
6 * ===================================================================================
7 * This Acumos software file is distributed by AT&T and Tech Mahindra
8 * under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * This file 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 com.logging.rest.example.springbootswagger2.controller;
25 * This class represents a common format set for the response send to the client.
26 * Getters and setters encapsulate the fields of a class by making them accessible
27 * only through its public methods and keep the values themselves private.
28 * @JsonProperty(name), tells Jackson ObjectMapper to map the JSON property name to the annotated Java field's name.
31 import java.io.Serializable;
33 import com.fasterxml.jackson.annotation.JsonProperty;
35 public class JsonResponse<T> implements Serializable {
37 private static final long serialVersionUID = -2934104266393591755L;
40 * Json property status.
42 @JsonProperty(value = JSONTags.TAG_RESPONSE_STATUS)
43 private Boolean status;
46 * Json property statusCode.
48 @JsonProperty(value = JSONTags.TAG_RESPONSE_STATUS_CODE)
49 private int statusCode;
52 * Json property responseDetail.
54 @JsonProperty(value = JSONTags.TAG_RESPONSE_DETAIL)
55 private String responseDetail;
58 * Json property responseCode.
60 @JsonProperty(value = JSONTags.TAG_RESPONSE_CODE)
61 private String responseCode;
64 * Json property responseBody. It represents the type of generic object.
66 @JsonProperty(value = JSONTags.TAG_RESPONSE_BODY)
67 private T responseBody;
70 * Json property content. It represents the type of generic object.
72 @JsonProperty(value = JSONTags.TAG_RESPONSE_CONTENT)
75 public Boolean getStatus() {
79 public void setStatus(Boolean status) {
83 public String getResponseDetail() {
84 return responseDetail;
87 public void setResponseDetail(String responseDetail) {
88 this.responseDetail = responseDetail;
92 * Json property errorCode.
94 @JsonProperty(value = JSONTags.TAG_ERROR_CODE)
95 private String errorCode;
97 public String getErrorCode() {
101 public void setErrorCode(String errorCode) {
102 this.errorCode = errorCode;
105 public String getResponseCode() {
109 public void setResponseCode(String responseCode) {
110 this.responseCode = responseCode;
113 public T getResponseBody() {
117 public void setResponseBody(T responseBody) {
118 this.responseBody = responseBody;
121 public T getContent() {
125 public void setContent(T responseBody) {
126 this.content = responseBody;
129 public int getStatusCode() {
133 public void setStatusCode(int statusCode) {
134 this.statusCode = statusCode;