com.strongloop.android.loopback

## Class RestAdapter

- java.lang.Object
- - com.strongloop.android.remoting.adapters.Adapter
  - - com.strongloop.android.remoting.adapters.RestAdapter
    - - com.strongloop.android.loopback.RestAdapter

    public class RestAdapter
    extends RestAdapter

An extension to the vanilla `RestAdapter` to make working with `Model`s easier.

### Nested Class Summary

### Nested classes/interfaces inherited from class com.strongloop.android.remoting.adapters.Adapter

`Adapter.BinaryCallback, Adapter.Callback, Adapter.JsonArrayCallback, Adapter.JsonCallback, Adapter.JsonObjectCallback`

### Field Summary

Fields
`static java.lang.String` `PROPERTY_ACCESS_TOKEN`
`static java.lang.String` `SHARED_PREFERENCES_NAME`

### Constructor Summary

Constructors
Constructor and Description
`RestAdapter(Context context, java.lang.String url)`

### Method Summary

Methods
`void` `clearAccessToken()`
`<U extends RestRepository> U` `createRepository(java.lang.Class<U> repositoryClass)` Creates a new `ModelRepository` from the given subclass.
`ModelRepository<Model>` `createRepository(java.lang.String name)` Creates a new `ModelRepository` representing the named model type.
`ModelRepository<Model>` `createRepository(java.lang.String name, java.lang.String nameForRestUrl)` Creates a new `ModelRepository` representing the named model type.
`<T extends Model> ModelRepository<T>` `createRepository(java.lang.String name, java.lang.String nameForRestUrl, java.lang.Class<T> modelClass)` Creates a new `ModelRepository` representing the named model type.
`Context` `getApplicationContext()`
`void` `setAccessToken(java.lang.String accessToken)`

### Methods inherited from class com.strongloop.android.remoting.adapters.RestAdapter

`connect, getClient, getContract, invokeInstanceMethod, invokeInstanceMethod, invokeStaticMethod, invokeStaticMethod, isConnected, setContract`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### SHARED_PREFERENCES_NAME

    public static final java.lang.String SHARED_PREFERENCES_NAME

#### PROPERTY_ACCESS_TOKEN

    public static final java.lang.String PROPERTY_ACCESS_TOKEN

See Also:
  Constant Field Values

### Constructor Detail

#### RestAdapter

    public RestAdapter(Context context,
               java.lang.String url)

### Method Detail

#### setAccessToken

    public void setAccessToken(java.lang.String accessToken)

#### clearAccessToken

    public void clearAccessToken()

#### getApplicationContext

    public Context getApplicationContext()

#### createRepository

    public ModelRepository<Model> createRepository(java.lang.String name)

Creates a new `ModelRepository` representing the named model type.

Parameters:
  `name` - The model name.
Returns:
  A new repository instance.

#### createRepository

    public ModelRepository<Model> createRepository(java.lang.String name,
                                          java.lang.String nameForRestUrl)

Creates a new `ModelRepository` representing the named model type.

Parameters:
  `name` - The model name.
  `nameForRestUrl` - The model name to use in REST URL, usually the plural form of `name`.
Returns:
  A new repository instance.

#### createRepository

    public <T extends Model> ModelRepository<T> createRepository(java.lang.String name,
                                                        java.lang.String nameForRestUrl,
                                                        java.lang.Class<T> modelClass)

Creates a new `ModelRepository` representing the named model type.

Parameters:
  `name` - The model name.
  `nameForRestUrl` - The model name to use in REST URL, usually the plural form of `name`.
  `modelClass` - The model class. The class must have a public no-argument constructor.
Returns:
  A new repository instance.

#### createRepository

    public <U extends RestRepository> U createRepository(java.lang.Class<U> repositoryClass)

Creates a new `ModelRepository` from the given subclass.

Parameters:
  `repositoryClass` - A subclass of `ModelRepository` to use. The class must have a public no-argument constructor.
Returns:
  A new repository instance.