com.pushtorefresh.storio.sqlite.impl.DefaultStorIOSQLite Java Examples

The following examples show how to use com.pushtorefresh.storio.sqlite.impl.DefaultStorIOSQLite. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(new StockUpdateGetResolver())
                    .deleteResolver(new StockUpdateDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #2
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(new StockUpdateGetResolver())
                    .deleteResolver(new StockUpdateDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #3
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(new StockUpdateGetResolver())
                    .deleteResolver(new StockUpdateDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #4
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(createGetResolver())
                    .deleteResolver(createDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #5
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(new StockUpdateGetResolver())
                    .deleteResolver(new StockUpdateDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #6
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(new StockUpdateGetResolver())
                    .deleteResolver(new StockUpdateDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #7
Source File: StorIOFactory.java    From Reactive-Android-Programming with MIT License 6 votes vote down vote up
public synchronized static StorIOSQLite get(Context context) {
    if (INSTANCE != null) {
        return INSTANCE;
    }

    INSTANCE = DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(new StorIODbHelper(context))
            .addTypeMapping(StockUpdate.class, SQLiteTypeMapping.<StockUpdate>builder()
                    .putResolver(new StockUpdatePutResolver())
                    .getResolver(new StockUpdateGetResolver())
                    .deleteResolver(new StockUpdateDeleteResolver())
                    .build())
            .build();

    return INSTANCE;
}
 
Example #8
Source File: StorIOHelper.java    From Hews with MIT License 6 votes vote down vote up
public static StorIOSQLite getStorIOSQLite(Context context) {
    if (mStorIOSQLite != null) {
        return mStorIOSQLite;
    }
    mStorIOSQLite = DefaultStorIOSQLite.builder()
        .sqliteOpenHelper(new DbOpenHelper(context))
        .addTypeMapping(Post.class, SQLiteTypeMapping.<Post>builder()
            // object that knows how to perform Put Operation (insert or update)
            .putResolver(new PostStorIOSQLitePutResolver())
            // object that knows how to perform Get Operation
            .getResolver(new PostStorIOSQLiteGetResolver())
            // object that knows how to perform Delete Operation
            .deleteResolver(new PostStorIOSQLiteDeleteResolver())
            .build())
        .addTypeMapping(Comment.class, SQLiteTypeMapping.<Comment>builder()
            .putResolver(new CommentStorIOSQLitePutResolver())
            .getResolver(new CommentStorIOSQLiteGetResolver())
            .deleteResolver(new CommentStorIOSQLiteDeleteResolver())
            .build())
        .build();

    return mStorIOSQLite;
}
 
Example #9
Source File: DbModule.java    From android with Apache License 2.0 5 votes vote down vote up
@Provides
@Singleton
StorIOSQLite provideStorIOSQLite(SQLiteOpenHelper sqLiteOpenHelper) {
    return DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(sqLiteOpenHelper)
            .addTypeMapping(PrayerCache.class, PrayerCacheMeta.MAPPER)
            .addTypeMapping(LocationCache.class, LocationCacheMeta.MAPPER)
            .build();
}
 
Example #10
Source File: Example2.java    From AnDevCon-RxPatterns with Apache License 2.0 5 votes vote down vote up
public StorIOSQLite provideStorIOSQLite(@NonNull SQLiteOpenHelper sqLiteOpenHelper) {
    return DefaultStorIOSQLite.builder()
            .sqliteOpenHelper(sqLiteOpenHelper)
            // ItemSQLiteTypeMapping is auto-generated at compile-time by StorIO
            .addTypeMapping(Item.class, new ItemSQLiteTypeMapping())
            .build();
}