Store2Store simplify the synchronization between Store of datas. For instance, you can easily synchronize a REST API with a local Realm datastore.
This is the rxJava2 implementation.
If you want to use a rxJava1 version, please use the 1.x.x tags (API is different).
# main build.gradle file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' } # add this line
}
}
# app/build.gradle file
compile 'com.github.playmoweb:store2store:3.0.0'
You can create your own store implementing StoreService :
public class MyStore<T> extends StoreService<T> {
public MyStore(Class<T> clazz) {
super(clazz, new MyStoreDao());
}
// internal class for the DAO
private class MyStoreDao extends StoreDao<T> {
// implements all methods of the abstract class you can need (some methods needs other to work)
}
}
public class MyConcreteModelStore extends MyStore<MyModel> {
public MyConcreteModelStore(){
super(MyModel.class);
this.syncWith(new MemoryStore()); // eg: sync with a newly created memoryStore
// you can inject a store with dagger and syncWith() here too :)
}
// Here you just have to implements the methods you need
}
Please see CONTRIBUTORS.md