Class ResponseStatusConverter
java.lang.Object
com.couchbase.client.core.endpoint.ResponseStatusConverter
public class ResponseStatusConverter extends Object
Helper class to easily convert different handler status types to a common one.
- Since:
- 1.1.2
- Author:
- Michael Nitschinger
- See Also:
ResponseStatus
,KeyValueStatus
-
Field Summary
Fields Modifier and Type Field Description static int
HTTP_ACCEPTED
static int
HTTP_BAD_REQUEST
static int
HTTP_CREATED
static int
HTTP_INTERNAL_ERROR
static int
HTTP_NOT_FOUND
static int
HTTP_OK
static int
HTTP_TOO_MANY_REQUESTS
static int
HTTP_UNAUTHORIZED
-
Constructor Summary
Constructors Constructor Description ResponseStatusConverter()
-
Method Summary
Modifier and Type Method Description static ResponseStatusDetails
detailsFromBinary(byte dataType, ByteBuf content)
static ResponseStatus
fromBinary(short code)
Convert the binary protocol status in a typesafe enum that can be acted upon later.static ResponseStatus
fromHttp(int code)
Convert the http protocol status in a typesafe enum that can be acted upon later.static ErrorMap
getBinaryErrorMap()
Get the current error map used by the response status converterstatic ErrorMap.ErrorCode
readErrorCodeFromErrorMap(short code)
Get the error code from Key Value error mapstatic void
updateBinaryErrorMap(ErrorMap map)
Updates the current error map in use for all uses of the response status converter.
-
Field Details
-
HTTP_OK
public static final int HTTP_OK- See Also:
- Constant Field Values
-
HTTP_CREATED
public static final int HTTP_CREATED- See Also:
- Constant Field Values
-
HTTP_ACCEPTED
public static final int HTTP_ACCEPTED- See Also:
- Constant Field Values
-
HTTP_BAD_REQUEST
public static final int HTTP_BAD_REQUEST- See Also:
- Constant Field Values
-
HTTP_UNAUTHORIZED
public static final int HTTP_UNAUTHORIZED- See Also:
- Constant Field Values
-
HTTP_NOT_FOUND
public static final int HTTP_NOT_FOUND- See Also:
- Constant Field Values
-
HTTP_INTERNAL_ERROR
public static final int HTTP_INTERNAL_ERROR- See Also:
- Constant Field Values
-
HTTP_TOO_MANY_REQUESTS
public static final int HTTP_TOO_MANY_REQUESTS- See Also:
- Constant Field Values
-
-
Constructor Details
-
ResponseStatusConverter
public ResponseStatusConverter()
-
-
Method Details
-
fromBinary
Convert the binary protocol status in a typesafe enum that can be acted upon later.- Parameters:
code
- the status to convert.- Returns:
- the converted response status.
-
readErrorCodeFromErrorMap
Get the error code from Key Value error map- Parameters:
code
- the status to convert.
-
fromHttp
Convert the http protocol status in a typesafe enum that can be acted upon later.- Parameters:
code
- the status to convert.- Returns:
- the converted response status.
-
detailsFromBinary
-
updateBinaryErrorMap
Updates the current error map in use for all uses of the response status converter. If the provided one is older than the one stored, this update operation will be ignored.- Parameters:
map
- the map in use, it always uses the latest one.
-
getBinaryErrorMap
Get the current error map used by the response status converter- Returns:
- error map
-