當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。