T
- the response data type.@NotThreadSafe @LevelUpApi(contract=PUBLIC) public abstract class AbstractResponse<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
AbstractResponse(Exception error)
Constructor for an error response.
|
protected |
AbstractResponse(int statusCode,
Exception error) |
protected |
AbstractResponse(int statusCode,
Map<String,List<String>> httpHeaders,
Exception error) |
Modifier and Type | Method and Description |
---|---|
abstract T |
getData() |
Exception |
getError() |
String |
getHttpHeader(String headerField)
Retrieves the desired HTTP header.
|
protected Map<String,List<String>> |
getHttpHeaders() |
int |
getHttpStatusCode() |
String |
toString() |
protected AbstractResponse(Exception error)
error
- any exception that was thrown during the request.protected AbstractResponse(int statusCode, Exception error)
statusCode
- the HTTP status code.error
- the Exception
that was thrown during the request or null
if
there was no error.protected AbstractResponse(int statusCode, Map<String,List<String>> httpHeaders, Exception error)
statusCode
- the HTTP status code of the response.httpHeaders
- the HTTP headers included in the response. This must be an unmodifiable
map, for example one wrapped using Collections.unmodifiableMap(Map)
.error
- the Exception
that was thrown during the request or null
if
there was no error.public abstract T getData()
public final int getHttpStatusCode()
public final String getHttpHeader(String headerField)
headerField
- the HTTP header field (the key). This value must be be normalized to
First-Letter-Caps.null
if no header is present.