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


Java Registration類代碼示例

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


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

示例1: getRegistration

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration getRegistration(final Class clazz) {
    // force all instances of Vertex, Edge, VertexProperty, etc. to their respective interface
    final Class type;
    if (!ReferenceVertex.class.isAssignableFrom(clazz) && !DetachedVertex.class.isAssignableFrom(clazz) && Vertex.class.isAssignableFrom(clazz))
        type = Vertex.class;
    else if (!ReferenceEdge.class.isAssignableFrom(clazz) && !DetachedEdge.class.isAssignableFrom(clazz) && Edge.class.isAssignableFrom(clazz))
        type = Edge.class;
    else if (!ReferenceVertexProperty.class.isAssignableFrom(clazz) && !DetachedVertexProperty.class.isAssignableFrom(clazz) && VertexProperty.class.isAssignableFrom(clazz))
        type = VertexProperty.class;
    else if (!ReferenceProperty.class.isAssignableFrom(clazz) && !DetachedProperty.class.isAssignableFrom(clazz) && !DetachedVertexProperty.class.isAssignableFrom(clazz) && Property.class.isAssignableFrom(clazz))
        type = Property.class;
    else if (!ReferencePath.class.isAssignableFrom(clazz) && !DetachedPath.class.isAssignableFrom(clazz) && Path.class.isAssignableFrom(clazz))
        type = Path.class;
    else
        type = clazz;

    if (type == memoizedClass) return memoizedClassValue;
    final Registration registration = classToRegistration.get(type);
    if (registration != null) {
        memoizedClass = type;
        memoizedClassValue = registration;
    }

    return registration;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:27,代碼來源:GryoClassResolver.java

示例2: readClass

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration readClass(final Input input) {
    final int classID = input.readVarInt(true);
    switch (classID) {
        case Kryo.NULL:
            return null;
        case NAME + 2: // Offset for NAME and NULL.
            return readName(input);
    }

    if (classID == memoizedClassId) return memoizedClassIdValue;
    final Registration registration = idToRegistration.get(classID - 2);
    if (registration == null) throw new KryoException("Encountered unregistered class ID: " + (classID - 2));
    memoizedClassId = classID;
    memoizedClassIdValue = registration;
    return registration;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:18,代碼來源:GryoClassResolver.java

示例3: readName

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
protected Registration readName(final Input input) {
    final int nameId = input.readVarInt(true);
    if (nameIdToClass == null) nameIdToClass = new IntMap<>();
    Class type = nameIdToClass.get(nameId);
    if (type == null) {
        // Only read the class name the first time encountered in object graph.
        final String className = input.readString();
        type = getTypeByName(className);
        if (type == null) {
            try {
                type = Class.forName(className, false, kryo.getClassLoader());
            } catch (ClassNotFoundException ex) {
                throw new KryoException("Unable to find class: " + className, ex);
            }
            if (nameToClass == null) nameToClass = new ObjectMap<>();
            nameToClass.put(className, type);
        }
        nameIdToClass.put(nameId, type);
    }
    return kryo.getRegistration(type);
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:22,代碼來源:GryoClassResolver.java

示例4: getRegistration

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
public Registration getRegistration(final Class clazz) {
    if (Color.class.isAssignableFrom(clazz)) {
        final Registration registration = super.getRegistration(TinkerGraph.class);
        return new Registration(registration.getType(), colorToGraphSerializer, registration.getId());
    } else {
        return super.getRegistration(clazz);
    }
}
 
開發者ID:ShiftLeftSecurity,項目名稱:tinkergraph-gremlin,代碼行數:9,代碼來源:TinkerGraphTest.java

示例5: register

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration register(final Registration registration) {
    if (null == registration) throw new IllegalArgumentException("Registration cannot be null.");
    if (registration.getId() != NAME) idToRegistration.put(registration.getId(), registration);

    classToRegistration.put(registration.getType(), registration);
    if (registration.getType().isPrimitive())
        classToRegistration.put(getWrapperClass(registration.getType()), registration);
    return registration;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:11,代碼來源:GryoClassResolver.java

示例6: writeClass

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration writeClass(final Output output, final Class type) {
    if (null == type) {
        output.writeVarInt(Kryo.NULL, true);
        return null;
    }

    final Registration registration = kryo.getRegistration(type);
    if (registration.getId() == NAME)
        writeName(output, type);
    else
        output.writeVarInt(registration.getId() + 2, true);

    return registration;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:16,代碼來源:GryoClassResolver.java

示例7: getRegistration

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration getRegistration(final Class clazz) {
    final Class type = coerceType(clazz);

    if (type == memoizedClass) return memoizedClassValue;
    final Registration registration = classToRegistration.get(type);
    if (registration != null) {
        memoizedClass = type;
        memoizedClassValue = registration;
    }

    return registration;
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:14,代碼來源:AbstractGryoClassResolver.java

示例8: getRegistration

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration getRegistration(Class clazz) {
    throw new RuntimeException("Registration is not allowed with this ClassResolver - it is not a good implementation");
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:5,代碼來源:GryoBaseMessageSerializerV1d0Test.java

示例9: registerImplicit

import org.apache.tinkerpop.shaded.kryo.Registration; //導入依賴的package包/類
@Override
public Registration registerImplicit(final Class type) {
    return register(new Registration(type, kryo.getDefaultSerializer(type), NAME));
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:5,代碼來源:GryoClassResolver.java


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