public class ServiceBase
extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
ServiceBase(RequestDispatcher requestDispatcher)
Create a service with the given connection.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkForError(JsonObject resultObj) |
protected <TResult> TResult |
decodeResponse(String response,
Class<TResult> resultParamsClass)
Decodes the JSON-RPC response.
|
protected <TRequest> String |
encodeRequest(String method,
TRequest requestParams,
Class<TRequest> requestParamsClass)
Constructs the JSON-RPC request.
|
protected ApiServerException |
extractApiError(JsonElement errorElem)
Decodes the error portion, if it exists, from the JSON-RPC response.
|
protected GsonBuilder |
getGsonBuilder()
Getter for property 'gsonBuilder'.
|
RequestDispatcher |
getRequestDispatcher()
Get the communication mechanism of this service.
|
<TResult,TRequest> |
sendRequest(String method,
TRequest requestParams,
Class<TRequest> requestParamsClass,
Class<TResult> resultParamsClass)
Send the request to the remote system.
|
protected ServiceBase(RequestDispatcher requestDispatcher)
requestDispatcher - is the mechanism for sending requests to some location.public RequestDispatcher getRequestDispatcher()
protected GsonBuilder getGsonBuilder()
public <TResult,TRequest> TResult sendRequest(String method,
TRequest requestParams,
Class<TRequest> requestParamsClass,
Class<TResult> resultParamsClass)
method - the api method namerequestParams - the object containing the request parametersrequestParamsClass - the class (type) of the request objectresultParamsClass - the class (type) of the results objectprotected <TRequest> String encodeRequest(String method,
TRequest requestParams,
Class<TRequest> requestParamsClass)
method - the api method namerequestParams - the object containing the request parametersrequestParamsClass - the class (type) of the request objectprotected <TResult> TResult decodeResponse(String response,
Class<TResult> resultParamsClass)
response - the JSON encoded responseresultParamsClass - the class (type) of the result object returnedprotected void checkForError(JsonObject resultObj)
throws ApiServerException
ApiServerExceptionprotected ApiServerException extractApiError(JsonElement errorElem)
errorElem - the JSON error objectCopyright © 2014-2016 NetApp, Inc. All Rights Reserved.