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


Java PojoDataContext类代码示例

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


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

示例1: createDataContext

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
@Override
public DataContext createDataContext(DataContextFactoryParameters params) {
    SimpleTableDef[] tableDefs = params.getTableDefs();
    if (tableDefs == null || tableDefs.length == 0) {
        throw new IllegalArgumentException("Cannot create PojoDataContext with no tableDefs specified");
    }
    
    TableDataProvider<?>[] tableDataProviders = new ArrayTableDataProvider[tableDefs.length];
    for (int i = 0; i < tableDataProviders.length; i++) {
        ArrayTableDataProvider tableDataProvider = new ArrayTableDataProvider(tableDefs[i], new ArrayList<Object[]>());
        tableDataProviders[i] = tableDataProvider;
    }
    
    String databaseName = params.getDatabaseName();
    if (databaseName != null && !databaseName.isEmpty()) {
        return new PojoDataContext(databaseName, tableDataProviders);
    }
    return new PojoDataContext(Arrays.asList(tableDataProviders));
}
 
开发者ID:apache,项目名称:metamodel,代码行数:20,代码来源:PojoDataContextFactoryBeanDelegate.java

示例2: testConvertTableDefs

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
public void testConvertTableDefs() throws Exception {
    final DataContextFactoryBean factoryBean = new DataContextFactoryBean();
    factoryBean.setType("POJO");
    factoryBean.setDatabaseName("my db");
    factoryBean.setTableDefinitions("hello world (greeting VARCHAR, who VARCHAR); foo (bar INTEGER, baz DATE);");

    final DataContext dataContext = factoryBean.getObject();
    assertTrue(dataContext instanceof PojoDataContext);

    Schema schema = dataContext.getDefaultSchema();
    assertEquals("my db", schema.getName());
    assertEquals("[foo, hello world]", Arrays.toString(schema.getTableNames().toArray()));

    assertEquals(
            "[Column[name=greeting,columnNumber=0,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
                    + "Column[name=who,columnNumber=1,type=VARCHAR,nullable=true,nativeType=null,columnSize=null]]",
            Arrays.toString(schema.getTableByName("hello world").getColumns().toArray()));

    assertEquals("[Column[name=bar,columnNumber=0,type=INTEGER,nullable=true,nativeType=null,columnSize=null], "
            + "Column[name=baz,columnNumber=1,type=DATE,nullable=true,nativeType=null,columnSize=null]]",
            Arrays.toString(schema.getTableByName("foo").getColumns().toArray()));
}
 
开发者ID:apache,项目名称:metamodel,代码行数:23,代码来源:PojoDataContextFactoryBeanDelegateTest.java

示例3: PojoDatastore

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
public PojoDatastore(final String datastoreName, final String schemaName,
        final List<TableDataProvider<?>> tableDataProviders) {
    _datastoreName = datastoreName;
    _dataContext = new PojoDataContext(schemaName, tableDataProviders);
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:6,代码来源:PojoDatastore.java

示例4: PojoDatastore

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
public PojoDatastore(String datastoreName, String schemaName, List<TableDataProvider<?>> tableDataProviders) {
    _datastoreName = datastoreName;
    _dataContext = new PojoDataContext(schemaName, tableDataProviders);
}
 
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:5,代码来源:PojoDatastore.java

示例5: testReadDataContext

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
@Test
public void testReadDataContext() {
    assertEquals(PojoDataContext.class, dataContext.getClass());

    assertEquals("here's a value from springs XML file", dataContext.getDefaultSchema().getName());
}
 
开发者ID:apache,项目名称:metamodel,代码行数:7,代码来源:MockDataContextTypeTest.java

示例6: createDataContext

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
@Override
public DataContext createDataContext(DataContextFactoryParameters bean) {
    String username = bean.getUsername();
    return new PojoDataContext(username, new ArrayList<TableDataProvider<?>>());
}
 
开发者ID:apache,项目名称:metamodel,代码行数:6,代码来源:MockDataContextFactoryBeanDelegate.java

示例7: createPojoDataContext

import org.apache.metamodel.pojo.PojoDataContext; //导入依赖的package包/类
/**
 * Creates a new POJO data context that is empty but can be populated at
 * will.
 * 
 * @return a DataContext object that matches the request
 * 
 */
public static DataContext createPojoDataContext() {
	return new PojoDataContext();
}
 
开发者ID:apache,项目名称:metamodel,代码行数:11,代码来源:DataContextFactory.java


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