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


Java U.forName方法代码示例

本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.forName方法的典型用法代码示例。如果您正苦于以下问题:Java U.forName方法的具体用法?Java U.forName怎么用?Java U.forName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.internal.util.typedef.internal.U的用法示例。


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

示例1: doReadClass

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @param in Binary input stream.
 * @param ctx Binary context.
 * @param ldr Class loader.
 * @param typeId Type id.
 * @return Class object specified at the input stream.
 * @throws BinaryObjectException If failed.
 */
public static Class doReadClass(BinaryInputStream in, BinaryContext ctx, ClassLoader ldr, int typeId)
    throws BinaryObjectException {
    Class cls;

    if (typeId != GridBinaryMarshaller.UNREGISTERED_TYPE_ID)
        cls = ctx.descriptorForTypeId(true, typeId, ldr, true).describedClass();
    else {
        String clsName = doReadClassName(in);

        try {
            cls = U.forName(clsName, ldr);
        }
        catch (ClassNotFoundException e) {
            throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
        }

        // forces registering of class by type id, at least locally
        ctx.descriptorForClass(cls, true);
    }

    return cls;
}
 
开发者ID:apache,项目名称:ignite,代码行数:31,代码来源:BinaryUtils.java

示例2: resolveClass

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Resolve the class.
 *
 * @param ctx Binary context.
 * @param typeId Type ID.
 * @param clsName Class name.
 * @param ldr Class loaded.
 * @return Resovled class.
 */
public static Class resolveClass(BinaryContext ctx, int typeId, @Nullable String clsName,
    @Nullable ClassLoader ldr, boolean deserialize) {
    Class cls;

    if (typeId != GridBinaryMarshaller.UNREGISTERED_TYPE_ID)
        cls = ctx.descriptorForTypeId(true, typeId, ldr, deserialize).describedClass();
    else {
        try {
            cls = U.forName(clsName, ldr);
        }
        catch (ClassNotFoundException e) {
            throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
        }

        // forces registering of class by type id, at least locally
        ctx.descriptorForClass(cls, true);
    }

    return cls;
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:BinaryUtils.java

示例3: BinaryBuilderEnum

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @param reader BinaryBuilderReader.
 */
public BinaryBuilderEnum(BinaryBuilderReader reader) {
    int typeId = reader.readInt();

    if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
        clsName = reader.readString();

        Class cls;

        try {
            cls = U.forName(reader.readString(), reader.binaryContext().configuration().getClassLoader());
        }
        catch (ClassNotFoundException e) {
            throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
        }

        this.typeId = reader.binaryContext().descriptorForClass(cls, false).typeId();
    }
    else {
        this.typeId = typeId;
        this.clsName = null;
    }

    ordinal = reader.readInt();
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:BinaryBuilderEnum.java

示例4: resolveClass

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
    // NOTE: DO NOT CHANGE TO 'clsLoader.loadClass()'
    // Must have 'Class.forName()' instead of clsLoader.loadClass()
    // due to weird ClassNotFoundExceptions for arrays of classes
    // in certain cases.
    return U.forName(desc.getName(), clsLdr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:JdkMarshallerObjectInputStream.java

示例5: getClass

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Class getClass(int typeId, ClassLoader ldr) throws ClassNotFoundException, IgniteCheckedException {
    String clsName = getClassName(JAVA_ID, typeId);

    if (clsName == null)
        throw new ClassNotFoundException("Unknown type ID: " + typeId);

    return U.forName(clsName, ldr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:MarshallerContextImpl.java

示例6: readClass

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @return Class.
 * @throws ClassNotFoundException If class was not found.
 * @throws IOException In case of other error.
 */
private Class<?> readClass() throws ClassNotFoundException, IOException {
    int compTypeId = readInt();

    return compTypeId == 0 ? U.forName(readUTF(), clsLdr) :
        classDescriptor(clsMap, compTypeId, clsLdr, ctx, mapper).describedClass();
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:OptimizedObjectInputStream.java

示例7: BinaryEnumArrayLazyValue

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @param reader Reader.
 */
protected BinaryEnumArrayLazyValue(BinaryBuilderReader reader) {
    super(reader, reader.position() - 1);

    int typeId = reader.readInt();

    if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
        clsName = reader.readString();

        Class cls;

        try {
            cls = U.forName(reader.readString(), reader.binaryContext().configuration().getClassLoader());
        }
        catch (ClassNotFoundException e) {
            throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
        }

        compTypeId = reader.binaryContext().descriptorForClass(cls, true).typeId();
    }
    else {
        compTypeId = typeId;
        clsName = null;
    }

    int size = reader.readInt();

    for (int i = 0; i < size; i++)
        reader.skipValue();

    len = reader.position() - valOff;
}
 
开发者ID:apache,项目名称:ignite,代码行数:35,代码来源:BinaryEnumArrayLazyValue.java

示例8: BinaryObjectArrayLazyValue

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @param reader Reader.
 */
protected BinaryObjectArrayLazyValue(BinaryBuilderReader reader) {
    super(reader, reader.position() - 1);

    int typeId = reader.readInt();

    if (typeId == GridBinaryMarshaller.UNREGISTERED_TYPE_ID) {
        clsName = reader.readString();

        Class cls;

        try {
            cls = U.forName(reader.readString(), reader.binaryContext().configuration().getClassLoader());
        }
        catch (ClassNotFoundException e) {
            throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
        }

        compTypeId = reader.binaryContext().descriptorForClass(cls, true).typeId();
    }
    else {
        compTypeId = typeId;
        clsName = null;
    }

    int size = reader.readInt();

    lazyValsArr = new Object[size];

    for (int i = 0; i < size; i++)
        lazyValsArr[i] = reader.parseValue();
}
 
开发者ID:apache,项目名称:ignite,代码行数:35,代码来源:BinaryObjectArrayLazyValue.java


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