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

The following examples show how to use com.pushtorefresh.storio.sqlite.impl.DefaultStorIOSQLite. These examples are extracted from open source projects. 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Reactive-Android-Programming   Source File: StorIOFactory.java    License: 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 Project: Hews   Source File: StorIOHelper.java    License: 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 Project: android   Source File: DbModule.java    License: 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 Project: AnDevCon-RxPatterns   Source File: Example2.java    License: 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();
}