T - the success response classpublic abstract class ApiResponse<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NO_TYPE
A constant for a response without a type
|
static java.lang.String |
PARSE_ERROR_TYPE
a constant for a response that errors while parsing
|
| Constructor and Description |
|---|
ApiResponse()
Construct an empty ApiResponse
|
ApiResponse(Error error)
Construct an ApiResponse from an error object
|
ApiResponse(io.nats.client.support.JsonValue jsonValue)
Construct an ApiResponse from a JsonValue
|
ApiResponse(Message msg)
construct an ApiResponse from a message
|
| Modifier and Type | Method and Description |
|---|---|
int |
getApiErrorCode()
The api error code from the server
|
@Nullable java.lang.String |
getDescription()
Get the error description
|
@Nullable java.lang.String |
getError()
Get the error object string
|
int |
getErrorCode()
The request error code from the server
|
@Nullable Error |
getErrorObject()
Get the error object
|
@Nullable io.nats.client.support.JsonValue |
getJv()
Get the JsonValue used to make this object
|
@Nullable java.lang.String |
getType()
The type of the response object
|
boolean |
hasError()
Does the response have an error
|
T |
throwOnHasError()
throw an Exception if the response had an error
|
java.lang.String |
toString() |
public static final java.lang.String NO_TYPE
public static final java.lang.String PARSE_ERROR_TYPE
public ApiResponse(Message msg)
msg - the messagepublic ApiResponse(io.nats.client.support.JsonValue jsonValue)
jsonValue - the valuepublic ApiResponse()
public ApiResponse(Error error)
error - the error objectpublic T throwOnHasError() throws JetStreamApiException
JetStreamApiException - if the response had an errorpublic @Nullable io.nats.client.support.JsonValue getJv()
public boolean hasError()
public @Nullable java.lang.String getType()
public int getErrorCode()
public int getApiErrorCode()
public @Nullable java.lang.String getDescription()
public @Nullable java.lang.String getError()
public @Nullable Error getErrorObject()
public java.lang.String toString()
toString in class java.lang.Object