當前位置: 首頁>>代碼示例>>Java>>正文


Java LegacyDeserializationObjectInputStream類代碼示例

本文整理匯總了Java中org.apache.metamodel.util.LegacyDeserializationObjectInputStream的典型用法代碼示例。如果您正苦於以下問題:Java LegacyDeserializationObjectInputStream類的具體用法?Java LegacyDeserializationObjectInputStream怎麽用?Java LegacyDeserializationObjectInputStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LegacyDeserializationObjectInputStream類屬於org.apache.metamodel.util包,在下文中一共展示了LegacyDeserializationObjectInputStream類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readObject

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    final GetField getFields = stream.readFields();
    Object primaryColumns = getFields.get("_primaryColumns", null);
    Object foreignColumns = getFields.get("_foreignColumns", null);
    if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) {
        primaryColumns = Arrays.<Column> asList((Column[]) primaryColumns);
        foreignColumns = Arrays.<Column> asList((Column[]) foreignColumns);
    }
    LegacyDeserializationObjectInputStream.setField(MutableRelationship.class, this, "_primaryColumns",
            primaryColumns);
    LegacyDeserializationObjectInputStream.setField(MutableRelationship.class, this, "_foreignColumns",
            foreignColumns);
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:14,代碼來源:MutableRelationship.java

示例2: readObject

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    final GetField getFields = stream.readFields();
    Object primaryColumns = getFields.get("primaryColumns", null);
    Object foreignColumns = getFields.get("foreignColumns", null);
    if (primaryColumns instanceof Column[] && foreignColumns instanceof Column[]) {
        primaryColumns = Arrays.<Column> asList((Column[]) primaryColumns);
        foreignColumns = Arrays.<Column> asList((Column[]) foreignColumns);
    }
    LegacyDeserializationObjectInputStream.setField(ImmutableRelationship.class, this, "primaryColumns",
            primaryColumns);
    LegacyDeserializationObjectInputStream.setField(ImmutableRelationship.class, this, "foreignColumns",
            foreignColumns);
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:14,代碼來源:ImmutableRelationship.java

示例3: testDeserializeBackwardsCompatible

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
public void testDeserializeBackwardsCompatible() throws Exception {
    Object obj;
    FileInputStream fileIn = new FileInputStream("src/test/resources/metamodel-3.0-default-row.ser");
    try {
        ObjectInputStream ois = new LegacyDeserializationObjectInputStream(fileIn);
        obj = ois.readObject();
        ois.close();
    } finally {
        FileHelper.safeClose(fileIn);
    }

    assertTrue(obj instanceof Row);
    assertTrue(obj instanceof DefaultRow);

    Row row = (Row) obj;
    assertEquals(2, row.size());
    List<SelectItem> selectItems = row.getSelectItems();
    assertEquals("foo", selectItems.get(0).toString());
    assertEquals("bar", selectItems.get(1).toString());

    assertEquals("foo", row.getValue(0));
    assertEquals("bar", row.getValue(1));

    assertEquals(Style.NO_STYLE, row.getStyle(0));
    assertEquals(Style.NO_STYLE, row.getStyle(1));

    Column column = selectItems.get(0).getColumn();
    assertNotNull(column);
    
    // the columns used to create the object did not have column types assigned.
    ColumnType type = column.getType();
    assertNull(type);
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:34,代碼來源:DefaultRowTest.java

示例4: testDeserializeOldFormat

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
@Test
public void testDeserializeOldFormat() throws Exception {
    final File file = new File("src/test/resources/metamodel-4.6.0-mutableschema-etc.ser");
    assertTrue(file.exists());

    try (final FileInputStream in = new FileInputStream(file)) {
        final LegacyDeserializationObjectInputStream ois = new LegacyDeserializationObjectInputStream(in);
        final Object obj = ois.readObject();
        assertTrue(obj instanceof MutableSchema);
        ois.close();

        final MutableSchema sch = (MutableSchema) obj;
        assertEquals("schema", sch.getName());

        assertEquals(2, sch.getTableCount());

        final Table table1 = sch.getTable(0);
        assertTrue(table1 instanceof MutableTable);
        assertEquals("t1", table1.getName());
        assertEquals(Arrays.asList("t1_c1", "t1_c2"), table1.getColumnNames());
        assertEquals(1, table1.getRelationshipCount());

        final Table table2 = sch.getTable(1);
        assertTrue(table2 instanceof MutableTable);
        assertEquals("t2", table2.getName());
        assertEquals(Arrays.asList("t2_c1"), table2.getColumnNames());
        assertEquals(1, table2.getRelationshipCount());

        final Relationship rel1 = table1.getRelationships().iterator().next();
        final Relationship rel2 = table2.getRelationships().iterator().next();
        assertSame(rel1, rel2);
        assertTrue(rel1 instanceof MutableRelationship);
    }
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:35,代碼來源:MutableSchemaTest.java

示例5: testDeserializeOldFormat

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
@Test
public void testDeserializeOldFormat() throws Exception {
    final File file = new File("src/test/resources/metamodel-4.6.0-immutableschema-etc.ser");
    assertTrue(file.exists());

    try (final FileInputStream in = new FileInputStream(file)) {
        final LegacyDeserializationObjectInputStream ois = new LegacyDeserializationObjectInputStream(in);
        final Object obj = ois.readObject();
        assertTrue(obj instanceof ImmutableSchema);
        ois.close();

        final ImmutableSchema sch = (ImmutableSchema) obj;
        assertEquals("schema", sch.getName());

        assertEquals(2, sch.getTableCount());

        final Table table1 = sch.getTable(0);
        assertTrue(table1 instanceof ImmutableTable);
        assertEquals("t1", table1.getName());
        assertEquals(Arrays.asList("t1_c1", "t1_c2"), table1.getColumnNames());
        assertEquals(1, table1.getRelationshipCount());

        final Table table2 = sch.getTable(1);
        assertTrue(table2 instanceof ImmutableTable);
        assertEquals("t2", table2.getName());
        assertEquals(Arrays.asList("t2_c1"), table2.getColumnNames());
        assertEquals(1, table2.getRelationshipCount());

        final Relationship rel1 = table1.getRelationships().iterator().next();
        final Relationship rel2 = table2.getRelationships().iterator().next();
        assertSame(rel1, rel2);
        assertTrue(rel1 instanceof ImmutableRelationship);
    }
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:35,代碼來源:ImmutableSchemaTest.java

示例6: readObject

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    final GetField getFields = stream.readFields();
    Object columns = getFields.get("_columns", null);
    if (columns instanceof Column[]) {
        columns = Arrays.<Column> asList((Column[]) columns);
    }
    final Object schema = getFields.get("_schema", null);
    final Object tableName = getFields.get("_tableName", null);
    LegacyDeserializationObjectInputStream.setField(CsvTable.class, this, "_columns", columns);
    LegacyDeserializationObjectInputStream.setField(CsvTable.class, this, "_schema", schema);
    LegacyDeserializationObjectInputStream.setField(CsvTable.class, this, "_tableName", tableName);
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:13,代碼來源:CsvTable.java

示例7: testDeserializeOldTable

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
@Test
public void testDeserializeOldTable() throws Exception {
    final File file = new File("src/test/resources/MetaModel-4.6.0-CsvTable.ser");
    try (LegacyDeserializationObjectInputStream in =
            new LegacyDeserializationObjectInputStream(new FileInputStream(file))) {
        final Object object = in.readObject();

        assertPeopleCsv(object);
    }
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:11,代碼來源:CsvTableTest.java

示例8: testSerializeAndDeserializeCurrentVersion

import org.apache.metamodel.util.LegacyDeserializationObjectInputStream; //導入依賴的package包/類
@Test
public void testSerializeAndDeserializeCurrentVersion() throws Exception {
    final DataContext dc = new CsvDataContext(new File("src/test/resources/csv_people.csv"));
    final Table table1 = dc.getDefaultSchema().getTables().get(0);
    assertPeopleCsv(table1);

    final byte[] bytes = SerializationUtils.serialize(table1);

    try (LegacyDeserializationObjectInputStream in =
            new LegacyDeserializationObjectInputStream(new ByteArrayInputStream(bytes))) {
        final Object object = in.readObject();

        assertPeopleCsv(object);
    }
}
 
開發者ID:apache,項目名稱:metamodel,代碼行數:16,代碼來源:CsvTableTest.java


注:本文中的org.apache.metamodel.util.LegacyDeserializationObjectInputStream類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。