Package net.solarnetwork.web.domain
Class Response<T>
java.lang.Object
net.solarnetwork.domain.Result<T>
net.solarnetwork.web.domain.Response<T>
- Type Parameters:
T- the object type
public class Response<T>
extends net.solarnetwork.domain.Result<T>
A simple service response envelope object.
- Version:
- 1.1
- Author:
- matt
-
Nested Class Summary
Nested classes/interfaces inherited from class net.solarnetwork.domain.Result
net.solarnetwork.domain.Result.ErrorDetail -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.solarnetwork.domain.Result
error, error, error, error, getCode, getData, getErrors, getMessage, getSuccess, result, success, success
-
Constructor Details
-
Response
public Response()Construct a successful response with no data. -
Response
Construct a successful response with just data.- Parameters:
data- the data
-
Response
Constructor.- Parameters:
success- flag of successcode- optional code, e.g. error codemessage- optional descriptive messagedata- optional data in the response
-
-
Method Details
-
response
Helper method to construct instance using generic return type inference. If you import this static method, then in your code you can writereturn response(myData)instead ofnew Response<Object>(myData).- Type Parameters:
V- the response data type- Parameters:
data- the data- Returns:
- the response
-