public class ModelRepository<T extends Model> extends Repository
Model creation, discovery, and
management.| Modifier and Type | Class and Description |
|---|---|
static interface |
ModelRepository.FindAllCallback<T extends Model> |
static interface |
ModelRepository.FindCallback<T extends Model> |
| Constructor and Description |
|---|
ModelRepository(java.lang.String className) |
ModelRepository(java.lang.String className,
java.lang.Class<T> modelClass)
Creates a new Repository, associating it with the named remote class.
|
ModelRepository(java.lang.String className,
java.lang.String nameForRestUrl,
java.lang.Class<T> modelClass)
Creates a new Repository, associating it with the named remote class.
|
| Modifier and Type | Method and Description |
|---|---|
RestContract |
createContract()
Creates a
RestContract representing this model type's custom
routes. |
T |
createModel(java.util.Map<java.lang.String,? extends java.lang.Object> parameters)
Creates a new
Model of this type with the parameters described. |
void |
findAll(ModelRepository.FindAllCallback<T> callback)
Finds and downloads all models of this type on and from the server.
|
void |
findById(java.lang.Object id,
ModelRepository.FindCallback<T> callback)
Finds and downloads a single instance of this model type on and from the
server with the given id.
|
createObject, getAdapter, getClassName, invokeStaticMethod, setAdapterpublic ModelRepository(java.lang.String className)
public ModelRepository(java.lang.String className,
java.lang.Class<T> modelClass)
className - The remote class name.modelClass - The Model class. It must have a public no-argument
constructor.public ModelRepository(java.lang.String className,
java.lang.String nameForRestUrl,
java.lang.Class<T> modelClass)
className - The remote class name.nameForRestUrl - The pluralized class name to use in REST transport.modelClass - The Model class. It must have a public no-argument
constructor.public RestContract createContract()
RestContract representing this model type's custom
routes. Used to extend an Adapter to support this model type.RestContract for this model type.public T createModel(java.util.Map<java.lang.String,? extends java.lang.Object> parameters)
Model of this type with the parameters described.parameters - The parameters.Model.public void findById(java.lang.Object id,
ModelRepository.FindCallback<T> callback)
id - The id to search for.callback - The callback to be executed when finished.public void findAll(ModelRepository.FindAllCallback<T> callback)
callback - The callback to be executed when finished.