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


Java RawType类代码示例

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


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

示例1: getAllRawTypeVersions

import com.sleepycat.persist.raw.RawType; //导入依赖的package包/类
/**
 * Returns all known versions of type information for a given class name,
 * or null if no persistent version of the class is known.
 *
 * @param className the name of the latest version of the class.
 *
 * @return an unmodifiable list of types for the given class name in order
 * from most recent to least recent.
 *
 * @throws IllegalStateException if this method is called for a model that
 * is not associated with an open store.
 */
public final List<RawType> getAllRawTypeVersions(String className) {
    if (catalog != null) {
        Format format = catalog.getLatestVersion(className);
        if (format != null) {
            List<RawType> list = new ArrayList<RawType>();
            while (format != null) {
                list.add(format);
                format = format.getPreviousVersion();
            }
            return Collections.unmodifiableList(list);
        } else {
            return null;
        }
    } else {
        throw new IllegalStateException("Store is not open");
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:30,代码来源:EntityModel.java

示例2: checkNonEntity

import com.sleepycat.persist.raw.RawType; //导入依赖的package包/类
/**
 * Checks that a non-entity class exists or does not exist.
 */
static void checkNonEntity(boolean exists,
                           EntityModel model,
                           Environment env,
                           String className,
                           int version) {
    if (exists) {
        ClassMetadata meta = model.getClassMetadata(className);
        TestCase.assertNotNull(meta);
        TestCase.assertEquals(version, meta.getVersion());
        TestCase.assertTrue(!meta.isEntityClass());

        RawType raw = model.getRawType(className);
        TestCase.assertNotNull(raw);
        TestCase.assertEquals(version, raw.getVersion());
    } else {
        TestCase.assertNull(model.getClassMetadata(className));
        TestCase.assertNull(model.getRawType(className));
    }

    TestCase.assertNull(model.getEntityMetadata(className));
    assertDbExists(false, env, className);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:26,代码来源:EvolveCase.java

示例3: checkRawType

import com.sleepycat.persist.raw.RawType; //导入依赖的package包/类
/**
 * Reads a raw object and checks its superclass names and versions.
 */
private static void checkRawType(RawType type,
                                 Object... classVersionPairs) {
    TestCase.assertNotNull(type);
    TestCase.assertNotNull(classVersionPairs);
    TestCase.assertTrue(classVersionPairs.length % 2 == 0);

    for (int i = 0; i < classVersionPairs.length; i += 2) {
        String clsName = (String) classVersionPairs[i];
        int clsVersion = (Integer) classVersionPairs[i + 1];
        TestCase.assertEquals(clsName, type.getClassName());
        TestCase.assertEquals(clsVersion, type.getVersion());
        type = type.getSuperType();
    }
    TestCase.assertNull(type);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:EvolveClasses.java

示例4: readRawObjects

import com.sleepycat.persist.raw.RawType; //导入依赖的package包/类
@Override
void readRawObjects(RawStore store,
                    boolean expectEvolved,
                    boolean expectUpdated)
    throws DatabaseException {

    if (expectEvolved) {
        TestCase.fail();
    }

    RawType embedType = store.getModel().getRawType(NAME);
    checkRawType(embedType, NAME, 0);

    RawObject embed =
        new RawObject(embedType, makeValues("f", 123), null);

    RawObject obj = readRaw(store, 99, NAME2, 0, CASECLS, 0);
    checkRawFields(obj, "key", 99, "embed", embed);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:20,代码来源:EvolveClasses.java

示例5: convert

import com.sleepycat.persist.raw.RawType; //导入依赖的package包/类
public Object convert(Object fromValue) {
    RawObject pet = (RawObject) fromValue;
    Map<String,Object> petValues = pet.getValues();
    Map<String,Object> subTypeValues = new HashMap<String,Object>();
    Boolean isCat = (Boolean) petValues.remove("isCatNotDog");
    Integer finickyLevel = (Integer) petValues.remove("finickyLevel");
    Double barkVolume = (Double) petValues.remove("barkVolume");
    RawType newSubType;
    if (isCat) {
        newSubType = catType;
        subTypeValues.put("finickyLevel", finickyLevel);
    } else {
        newSubType = dogType;
        subTypeValues.put("barkVolume", barkVolume);
    }
    RawObject newPet = new RawObject
        (newPetType, petValues, pet.getSuper());
    return new RawObject(newSubType, subTypeValues, newPet);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:20,代码来源:EvolveClasses.java


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