public interface LightblueResponse
To wrap a response from the lightblue client library, see
fromClientResponse(com.redhat.lightblue.client.response.LightblueResponse)
Typical use cases vary on how you would handle a failed response
getSuccess() and let the
exception propagate if it failed.isSuccess() first, and if false use the response from getFailure()
| Modifier and Type | Method and Description |
|---|---|
static LightblueResponse |
fromClientResponse(com.redhat.lightblue.client.response.LightblueResponse response)
Wraps a response from the lightblue client library which may or may not be successful in a
type which allows easily querying whether or not the response was successful and getting at
the right type of response.
|
com.redhat.lightblue.client.response.LightblueErrorResponse |
getFailure() |
com.redhat.lightblue.client.response.LightblueDataResponse |
getSuccess()
Returns the response if it was successful as a
LightblueDataResponse matching the
successful lightblue response schema. |
boolean |
isSuccess()
This response can represent both a successful and failed one.
|
com.redhat.lightblue.client.response.LightblueDataResponse getSuccess()
throws LightblueResponseException
LightblueDataResponse matching the
successful lightblue response schema. If the response was not successful, then an unchecked
LightblueResponseException is thrown with the lightblue errors in the response.
You should query if the response was successful or not first with isSuccess(),
unless all you would do is throw an exception if it failed. In that case, you could just call
getSuccess() unconditionally and let the exception propagate.
LightblueResponseException - if this response is not a successful one. Check if the
response is successful first with isSuccess().boolean isSuccess()
com.redhat.lightblue.client.response.LightblueErrorResponse getFailure()
throws NoSuchElementException
NoSuchElementException - if this response is not a failed one. Check if the
response is successful first with isSuccess().static LightblueResponse fromClientResponse(com.redhat.lightblue.client.response.LightblueResponse response)
Copyright © 2017. All rights reserved.