public static class RestAdapter.Builder extends Object
RestAdapter
.
Calling the following methods is required before calling build()
:
If you are using asynchronous execution (i.e., with Callbacks
) the following
is also required:
Constructor and Description |
---|
RestAdapter.Builder() |
Modifier and Type | Method and Description |
---|---|
RestAdapter |
build()
Create the
RestAdapter instances. |
RestAdapter.Builder |
setClient(Client.Provider clientProvider)
The HTTP client used for requests.
|
RestAdapter.Builder |
setClient(Client client)
The HTTP client used for requests.
|
RestAdapter.Builder |
setConverter(Converter converter)
The converter used for serialization and deserialization of objects.
|
RestAdapter.Builder |
setErrorHandler(ErrorHandler errorHandler)
The error handler allows you to customize the type of exception thrown for errors on
synchronous requests.
|
RestAdapter.Builder |
setExecutors(Executor httpExecutor,
Executor callbackExecutor)
Executors used for asynchronous HTTP client downloads and callbacks.
|
RestAdapter.Builder |
setLog(RestAdapter.Log log)
Configure debug logging mechanism.
|
RestAdapter.Builder |
setLogLevel(RestAdapter.LogLevel logLevel)
Change the level of logging.
|
RestAdapter.Builder |
setProfiler(Profiler profiler)
Set the profiler used to measure requests.
|
RestAdapter.Builder |
setRequestInterceptor(RequestInterceptor requestInterceptor)
A request interceptor for adding data to every request.
|
RestAdapter.Builder |
setServer(Server server)
API server.
|
RestAdapter.Builder |
setServer(String endpoint)
API server base URL.
|
public RestAdapter.Builder setServer(String endpoint)
public RestAdapter.Builder setServer(Server server)
public RestAdapter.Builder setClient(Client client)
public RestAdapter.Builder setClient(Client.Provider clientProvider)
public RestAdapter.Builder setExecutors(Executor httpExecutor, Executor callbackExecutor)
httpExecutor
- Executor on which HTTP client calls will be made.callbackExecutor
- Executor on which any Callback
methods will be invoked. If
this argument is null
then callback methods will be run on the same thread as the
HTTP client.public RestAdapter.Builder setRequestInterceptor(RequestInterceptor requestInterceptor)
public RestAdapter.Builder setConverter(Converter converter)
public RestAdapter.Builder setProfiler(Profiler profiler)
public RestAdapter.Builder setErrorHandler(ErrorHandler errorHandler)
public RestAdapter.Builder setLog(RestAdapter.Log log)
public RestAdapter.Builder setLogLevel(RestAdapter.LogLevel logLevel)
public RestAdapter build()
RestAdapter
instances.Copyright © 2013 Square, Inc.. All Rights Reserved.