
com.evento.common.modeling.messaging.query.Single Maven / Gradle / Ivy
Show all versions of evento-common Show documentation
package com.evento.common.modeling.messaging.query;
import com.evento.common.modeling.messaging.payload.View;
/**
* Creates a new instance of the Single class.
* @param the view response of a query
*/
public class Single extends QueryResponse {
private T data;
/**
* The Single class represents a response containing a single view object.
* It extends the QueryResponse class.
*
* This class is generic and the type parameter T must extend the View class.
* It provides methods to set and retrieve the data from the response.
*/
public Single() {
}
/**
* Creates a new Single object with the given data.
*
* @param the type of the data in the response, must extend the View class
* @param data the data to set in the response
* @return the Single object with the provided data
*/
public static Single of(R data) {
var r = new Single();
r.setData(data);
return r;
}
/**
* Retrieves the data stored in the response object.
*
* @return the data stored in the response object
*/
public T getData() {
return data;
}
/**
* Sets the data in the response object.
*
* @param data the data to be set in the response object. It must extend the View class.
*/
public void setData(T data) {
this.data = data;
}
}