当前位置: 首页>>代码示例>>Java>>正文


Java Configuration类代码示例

本文整理汇总了Java中io.requery.sql.Configuration的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Configuration类属于io.requery.sql包,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: provideDatabaseSource

import io.requery.sql.Configuration; //导入依赖的package包/类
@Singleton
@Provides
public EntityDataStore<Persistable> provideDatabaseSource() {
    Observable.<Void>just(null).observeOn(Schedulers.io()).subscribe(new Action1<Void>() {
        @Override
        public void call(Void aVoid) {
            raw2data(app, DB_NAME, R.raw.books);
        }
    });

    DatabaseSource source = new DatabaseSource(app, Models.DEFAULT, DB_NAME, DB_VERSION);
    source.setLoggingEnabled(BuildConfig.DEBUG);
    Configuration configuration = source.getConfiguration();

    return new EntityDataStore<>(configuration);
}
 
开发者ID:xdtianyu,项目名称:Kindle,代码行数:17,代码来源:AppModule.java

示例2: getConfiguration

import io.requery.sql.Configuration; //导入依赖的package包/类
@Override
public Configuration getConfiguration() {
    if (mapping == null) {
        mapping = onCreateMapping(platform);
    }
    if (mapping == null) {
        throw new IllegalStateException();
    }
    if (configuration == null) {
        ConfigurationBuilder builder = new ConfigurationBuilder(this, model)
            .setMapping(mapping)
            .setPlatform(platform)
            .setBatchUpdateSize(1000);
        onConfigure(builder);
        configuration = builder.build();
    }
    return configuration;
}
 
开发者ID:requery,项目名称:requery,代码行数:19,代码来源:DatabaseSource.java

示例3: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.MODEL2;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EmptyEntityCache())
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = new EntityDataStore<>(configuration);
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:TimeConversionsTest.java

示例4: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(new H2());
    EntityModel model = Models.JPA;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();
    data = new EntityDataStore<>(configuration);
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.dropTables();
    TableCreationMode mode = TableCreationMode.CREATE;
    System.out.println(tables.createTablesString(mode));
    tables.createTables(mode);
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:JPAModelTest.java

示例5: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.MODEL3;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EmptyEntityCache())
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    System.out.println(tables.createTablesString(TableCreationMode.DROP_CREATE));
    data = new EntityDataStore<>(configuration);
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:UpsertTest.java

示例6: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = new ReactorEntityStore<>(new EntityDataStore<Persistable>(configuration));
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:ReactorTest.java

示例7: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = Models.STATELESS;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EmptyEntityCache())
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    System.out.println(tables.createTablesString(TableCreationMode.DROP_CREATE));
    data = new EntityDataStore<>(configuration);
}
 
开发者ID:requery,项目名称:requery,代码行数:17,代码来源:StatelessTest.java

示例8: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(new SQLite());
    EntityModel model = Models.AUTOVALUE;
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .build())
        .build();
    data = new EntityDataStore<>(configuration);
    SchemaModifier tables = new SchemaModifier(configuration);
    tables.dropTables();
    TableCreationMode mode = TableCreationMode.CREATE_NOT_EXISTS;
    System.out.println(tables.createTablesString(mode));
    tables.createTables(mode);
}
 
开发者ID:requery,项目名称:requery,代码行数:18,代码来源:AutoValueModelTest.java

示例9: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:ReactiveTest.java

示例10: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    Platform platform = new HSQL();
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    CachingProvider provider = Caching.getCachingProvider();
    CacheManager cacheManager = provider.getCacheManager();
    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .setEntityCache(new EntityCacheBuilder(model)
            .useReferenceCache(true)
            .useSerializableCache(true)
            .useCacheManager(cacheManager)
            .build())
        .build();

    SchemaModifier tables = new SchemaModifier(configuration);
    tables.createTables(TableCreationMode.DROP_CREATE);
    data = RxSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
 
开发者ID:requery,项目名称:requery,代码行数:23,代码来源:RxTest.java

示例11: setup

import io.requery.sql.Configuration; //导入依赖的package包/类
@Before
public void setup() throws SQLException {
    CommonDataSource dataSource = DatabaseType.getDataSource(platform);
    EntityModel model = io.requery.test.model.Models.DEFAULT;

    Configuration configuration = new ConfigurationBuilder(dataSource, model)
        .useDefaultLogging()
        .setStatementCacheSize(10)
        .setBatchUpdateSize(50)
        .setWriteExecutor(Executors.newSingleThreadExecutor())
        .build();

    schemaModifier = new SchemaModifier(configuration);
    try {
        schemaModifier.dropTables();
    } catch (Exception e) {
        // expected if 'drop if exists' not supported (so ignore in that case)
        if (!platform.supportsIfExists()) {
            throw e;
        }
    }
    schemaModifier.createTables(TableCreationMode.CREATE);
}
 
开发者ID:requery,项目名称:requery,代码行数:24,代码来源:SchemaModifierTest.java

示例12: kotlinStore

import io.requery.sql.Configuration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void kotlinStore() throws Exception {
  new MockUnit(Env.class, Config.class, Binder.class, EntityModel.class, Registry.class)
      .expect(newDataSource(true))
      .expect(keys)
      .expect(zeroModels)
      .expect(noSchema)
      .expect(store(KotlinEntityDataStore.class, "DEFAULT"))
      .expect(onStart)
      .expect(configurationBuilder)
      .expect(unit -> {
        unit.constructor(KotlinEntityDataStore.class)
            .build(unit.get(Configuration.class));
      })
      .run(unit -> {
        Requery.kotlin(unit.get(EntityModel.class))
            .configure(unit.get(Env.class), unit.get(Config.class), unit.get(Binder.class));
      }, unit -> {
        unit.captured(Throwing.Consumer.class).iterator().next()
            .accept(unit.get(Registry.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:24,代码来源:RequeryTest.java

示例13: getData

import io.requery.sql.Configuration; //导入依赖的package包/类
@NonNull
public ReactiveEntityStore<Persistable> getData() throws RuntimeException {
    if (dataStore == null) {
        // override onUpgrade to handle migrating to a new version
        DatabaseSource source = new DatabaseSource(getReflectedContext(), Models.DEFAULT, 1);
        if (BuildConfig.DEBUG) {
            // use this in development mode to drop and recreate the tables on every upgrade
            source.setTableCreationMode(TableCreationMode.DROP_CREATE);
        }
        Configuration configuration = source.getConfiguration();
        dataStore = ReactiveSupport.toReactiveStore(
                new EntityDataStore<Persistable>(configuration));
    }
    return dataStore;
}
 
开发者ID:kbiakov,项目名称:newsreader-mvp-android,代码行数:16,代码来源:DbManager.java

示例14: getDataStore

import io.requery.sql.Configuration; //导入依赖的package包/类
public static EntityDataStore<Persistable> getDataStore(DatabaseSource source) {
    Configuration configuration = new ConfigurationBuilder(source, Models.DEFAULT)
            .setMapping(new MainMapping())
            .setStatementCacheSize(100)
            .setEntityCache(new EntityCacheBuilder(Models.DEFAULT)
                    .useReferenceCache(true)
                    .build())
            .build();
    return new EntityDataStore<>(configuration);
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:11,代码来源:SqlHelper.java

示例15: provideDataStore

import io.requery.sql.Configuration; //导入依赖的package包/类
@Provides
    @Singleton
    public SingleEntityStore<Persistable> provideDataStore(@NonNull final Context poContext) {
//        final DatabaseProvider<SQLiteDatabase> loSource = new DatabaseSource(poContext, Models.DEFAULT, "android_starter_alt.sqlite", 1);
        final DatabaseProvider<SQLiteDatabase> loSource = new SqlCipherDatabaseSource(poContext, Models.DEFAULT, "android_start_alt_requery_sqlcipher.sqlite", "android_starter_alt", 1);
        final Configuration loConfiguration = loSource.getConfiguration();
        final SingleEntityStore<Persistable> loDataStore = RxSupport.toReactiveStore(new EntityDataStore<>(loConfiguration));
        return loDataStore;
    }
 
开发者ID:RoRoche,项目名称:AndroidStarterAlt,代码行数:10,代码来源:ModuleDatabase.java


注:本文中的io.requery.sql.Configuration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。