public class ModelRepository<T extends Model> extends RestRepository<T>
Model creation, discovery, and
management.| Modifier and Type | Class and Description |
|---|---|
static interface |
ModelRepository.FindAllCallback<T extends Model>
Deprecated.
Use {link ListCallback} instead.
|
static interface |
ModelRepository.FindCallback<T extends Model>
Deprecated.
Use {link ObjectCallback} instead.
|
| 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)
Deprecated.
Use {link ModelRepository#createObject} instead.
|
T |
createObject(java.util.Map<java.lang.String,? extends java.lang.Object> parameters)
Creates a new
Model of this type with the parameters described. |
void |
findAll(ListCallback<T> callback)
Finds and downloads all models of this type on and from the server.
|
void |
findById(java.lang.Object id,
ObjectCallback<T> callback)
Finds and downloads a single instance of this model type on and from the
server with the given id.
|
java.lang.String |
getNameForRestUrl()
Returns the name of the REST url
|
getApplicationContext, getRestAdaptergetAdapter, getClassName, invokeStaticMethod, 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.
Use null for the default value, which is the plural
form of className.modelClass - The Model class. It must have a public no-argument
constructor.public java.lang.String getNameForRestUrl()
public RestContract createContract()
RestContract representing this model type's custom
routes. Used to extend an Adapter to support this model type.createContract in class RestRepository<T extends Model>RestContract for this model type.public T createModel(java.util.Map<java.lang.String,? extends java.lang.Object> parameters)
public T createObject(java.util.Map<java.lang.String,? extends java.lang.Object> parameters)
Model of this type with the parameters described.createObject in class Repository<T extends Model>parameters - The parameters.Model.public void findById(java.lang.Object id,
ObjectCallback<T> callback)
id - The id to search for.callback - The callback to be executed when finished.public void findAll(ListCallback<T> callback)
callback - The callback to be executed when finished.