Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.sample.eventmanager.dto; import com.fasterxml.jackson.annotation.JsonTypeInfo; import java.util.Objects; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * * @author Ryo Shindo * @param <T> */ @XmlRootElement public class JsonFormat<T extends Object> { @XmlElement private Integer status; @XmlElement private String message; @XmlElement private T data; public JsonFormat() { } public JsonFormat(Integer status, String message, T data) { this.status = status; this.message = message; this.data = data; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public T getData() { return data; } public void setData(T data) { this.data = data; } @Override public int hashCode() { return super.hashCode(); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final JsonFormat<?> other = (JsonFormat<?>) obj; if (!Objects.equals(this.status, other.status)) { return false; } if (!Objects.equals(this.message, other.message)) { return false; } if (!Objects.equals(this.data, other.data)) { return false; } return true; } @Override public String toString() { return "{status: " + status + ", message: " + message + ", data: " + data + '}'; } }