本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}