com.strongloop.android.remoting

## Class Repository<T extends VirtualObject>

- java.lang.Object
- - com.strongloop.android.remoting.Repository<T>

Direct Known Subclasses:
  RestRepository

    public class Repository<T extends VirtualObject>
    extends java.lang.Object

A local representative of remote model repository, it provides access to static methods like

    User.findById()

.

### Constructor Summary

Constructors
Constructor and Description
`Repository(java.lang.String className)` Creates a new Repository, associating it with the named remote class.
`Repository(java.lang.String className, java.lang.Class<T> objectClass)` Creates a new Repository, associating it with the named remote class.

### Method Summary

Methods
`T` `createObject(java.util.Map<java.lang.String,? extends java.lang.Object> creationParameters)` Creates a new `VirtualObject` as a virtual instance of this remote class.
`Adapter` `getAdapter()` Gets the `Adapter` that should be used for invoking methods, both for static methods on this prototype and all methods on all instances of this prototype.
`java.lang.String` `getClassName()` Gets the name given to this prototype on the server.
`void` `invokeStaticMethod(java.lang.String method, java.util.Map<java.lang.String,? extends java.lang.Object> parameters, Adapter.BinaryCallback callback)` Invokes a remotable method exposed statically within this class on the server, parses the response as binary data.
`void` `invokeStaticMethod(java.lang.String method, java.util.Map<java.lang.String,? extends java.lang.Object> parameters, Adapter.Callback callback)` Invokes a remotable method exposed statically within this class on the server.
`void` `setAdapter(Adapter adapter)` Sets the `Adapter` that should be used for invoking methods, both for static methods on this prototype and all methods on all instances of this prototype.

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

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

### Constructor Detail

#### Repository

    public Repository(java.lang.String className)

Creates a new Repository, associating it with the named remote class.

Parameters:
  `className` - The remote class name.

#### Repository

    public Repository(java.lang.String className,
              java.lang.Class<T> objectClass)

Creates a new Repository, associating it with the named remote class.

Parameters:
  `className` - The remote class name.

### Method Detail

#### getClassName

    public java.lang.String getClassName()

Gets the name given to this prototype on the server.

Returns:
  the class name.

#### getAdapter

    public Adapter getAdapter()

Gets the `Adapter` that should be used for invoking methods, both for static methods on this prototype and all methods on all instances of this prototype.

Returns:
  the adapter.

#### setAdapter

    public void setAdapter(Adapter adapter)

Sets the `Adapter` that should be used for invoking methods, both for static methods on this prototype and all methods on all instances of this prototype.

Parameters:
  `adapter` - The adapter.

#### createObject

    public T createObject(java.util.Map<java.lang.String,? extends java.lang.Object> creationParameters)

Creates a new `VirtualObject` as a virtual instance of this remote class.

Parameters:
  `creationParameters` - The creation parameters of the new object.
Returns:
  A new `VirtualObject` based on this prototype.

#### invokeStaticMethod

    public void invokeStaticMethod(java.lang.String method,
                          java.util.Map<java.lang.String,? extends java.lang.Object> parameters,
                          Adapter.Callback callback)

Invokes a remotable method exposed statically within this class on the server.

Parameters:
  `method` - The method to invoke (without the class name), e.g. `"doSomething"`.
  `parameters` - The parameters to invoke with.
  `callback` - The callback to invoke when the execution finishes.
See Also:
  `Adapter.invokeStaticMethod(String, Map, com.strongloop.android.remoting.adapters.Adapter.Callback)`

#### invokeStaticMethod

    public void invokeStaticMethod(java.lang.String method,
                          java.util.Map<java.lang.String,? extends java.lang.Object> parameters,
                          Adapter.BinaryCallback callback)

Invokes a remotable method exposed statically within this class on the server, parses the response as binary data.

Parameters:
  `method` - The method to invoke (without the class name), e.g. `"doSomething"`.
  `parameters` - The parameters to invoke with.
  `callback` - The callback to invoke when the execution finishes.
See Also:
  `Adapter.invokeStaticMethod(String, Map, com.strongloop.android.remoting.adapters.Adapter.Callback)`