Package org.eclipse.hono.util
Class TenantResult<T>
java.lang.Object
org.eclipse.hono.util.RequestResponseResult<T>
org.eclipse.hono.util.TenantResult<T>
- Type Parameters:
T
- The concrete type of the payload that is conveyed in the result.
A container for the result returned by Hono's Tenant API.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TenantResult<T>
from
(int status) Creates a new result for a status code.static <T> TenantResult<T>
from
(int status, T payload) Creates a new result for a status code and payload.static <T> TenantResult<T>
from
(int status, T payload, CacheDirective cacheDirective) Creates a new result for a status code and payload.static <T> TenantResult<T>
from
(int status, T payload, CacheDirective cacheDirective, Map<String, Object> responseProperties) Creates a new result for a status code and payload.<U> TenantResult<U>
Map the payload type, if set.Methods inherited from class org.eclipse.hono.util.RequestResponseResult
getCacheDirective, getPayload, getResponseProperties, getStatus, isError, isNotFound, isOk
-
Method Details
-
from
Creates a new result for a status code.- Type Parameters:
T
- The type of the payload conveyed in the result.- Parameters:
status
- The code indicating the outcome of processing the request.- Returns:
- The result.
-
from
Creates a new result for a status code and payload.- Type Parameters:
T
- The type of the payload conveyed in the result.- Parameters:
status
- The code indicating the outcome of processing the request.payload
- The payload contained in the response message ornull
, if the response does not contain any payload data.- Returns:
- The result.
-
from
Creates a new result for a status code and payload.- Type Parameters:
T
- The type of the payload conveyed in the result.- Parameters:
status
- The code indicating the outcome of processing the request.payload
- The payload contained in the response message ornull
, if the response does not contain any payload data.cacheDirective
- Restrictions regarding the caching of the payload by the receiver of the result ornull
if no restrictions apply.- Returns:
- The result.
-
from
public static <T> TenantResult<T> from(int status, T payload, CacheDirective cacheDirective, Map<String, Object> responseProperties) Creates a new result for a status code and payload.- Type Parameters:
T
- The type of the payload conveyed in the result.- Parameters:
status
- The code indicating the outcome of processing the request.payload
- The payload contained in the response message ornull
, if the response does not contain any payload data.cacheDirective
- Restrictions regarding the caching of the payload by the receiver of the result ornull
if no restrictions apply.responseProperties
- Arbitrary additional properties conveyed in the response message ornull
, if the response does not contain additional properties.- Returns:
- The result.
-
map
Map the payload type, if set.- Type Parameters:
U
- The target type.- Parameters:
mapper
- The mapping function to use for transforming the payload to the target type.- Returns:
- The mapped result.
-