public class RestAdapter extends Object
API endpoints are defined as methods on an interface with annotations providing metadata about the form in which the HTTP call should be made.
The relative path for a given method is obtained from an annotation on the method describing
the request type. The built-in methods are GET
,
PUT
, POST
, HEAD
,
and DELETE
. You can define your own HTTP method by creating an
annotation that takes a {code String} value and itself is annotated with
@RestMethod
.
Method parameters can be used to replace parts of the URL by annotating them with
@Path
. Replacement sections are denoted by an identifier surrounded
by curly braces (e.g., "{foo}"). To add items to the query string of a URL use
@Query
. If the path or query element has already been URI encoded
use @EncodedPath
or {@link retrofit.http.EncodedQuery
Modifier and Type | Class and Description |
---|---|
static class |
RestAdapter.Builder
Build a new
RestAdapter . |
static interface |
RestAdapter.Log
Simple logging abstraction for debug messages.
|
static class |
RestAdapter.LogLevel
Controls the level of logging.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
create(Class<T> service)
Create an implementation of the API defined by the specified
service interface. |
RestAdapter.LogLevel |
getLogLevel()
The current logging level.
|
void |
setLogLevel(RestAdapter.LogLevel loglevel)
Change the level of logging.
|
public void setLogLevel(RestAdapter.LogLevel loglevel)
public RestAdapter.LogLevel getLogLevel()
public <T> T create(Class<T> service)
service
interface.Copyright © 2013 Square, Inc.. All Rights Reserved.