Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.theagilemonkeys.meets.models.base;
  
  
  import java.util.Map;

Android Meets SDK Original work Copyright (c) 2014 [TheAgileMonkeys]

Author(s):
Álvaro López Espinosa
 
 public interface MeetsCollection<MODEL> extends ApiMethodModelHelperInterface<MeetsCollection<MODEL>>, MeetsSerializable {
    
Fetch a new bunch of models from the server, using page, pageSize and any extra filters set with setFilters. It can trigger any of these events (and in that specific order): - listener.onReset if the collection has been configured to reset on fetch. At this point, the collection is empty. - listener.onPush for each model added which was not already present in the collection. - listener.onFetch when all models has been added, so the fetch operation has finished.

Returns:
This object for chaining purposes
 
     MeetsCollection<MODEL> fetch();

    
Add a model to the collection. If the model already exist (its id is the same as any other in the collection) it WON'T be added. Triggers listener.onPush when the model is successfully added.

Parameters:
model The model to add.
Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> insert(MODEL model);

    
Extract the model with the passed id. Triggers listener.onExtract when the model is successfully extracted.

Parameters:
modelId Id of the model
Returns:
The extracted model
 
     MODEL extract(int modelId);

    
Extract all the models. Triggers listener.onExtract for each extracted model and then listener.onReset

Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> reset();

    
Returns the number of model in this collection

Returns:
 
     int getSize();
 
     MODEL get(int index);
    
Increment the page. Useful before fetch a new page of models from the server.

Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> nextPage();

    
Set a specific page. Useful before fetch a new page of models from the server.

Parameters:
page The number of page
Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> setPage(int page);

    
Sets the number of models fetched from the server for each page.

Parameters:
pageSize The number of models per page
Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> setPageSize(int pageSize);

    
If a true is passed, then each call to fetch will replace the entire collection with the models fetched.

Parameters:
reset A boolean value.
Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> setResetOnFetch(boolean reset);

    
Sets any filters that will be send to server in each call to fetch.

Parameters:
filters A Map with filters
Returns:
this object for chaining purposes
 
     MeetsCollection<MODEL> setFilters(Map<StringObjectfilters);

    
Get the current page

Returns:
int
 
     int getPage();

    
Get the current page size

Returns:
int
 
     int getPageSize();

    
TODO

Parameters:
weakAttributes
Returns:
    MeetsCollection<MODEL> include(String... weakAttributes);
New to GrepCode? Check out our FAQ X