本文整理汇总了C#中ClassLoaderWrapper.LoadClassByDottedName方法的典型用法代码示例。如果您正苦于以下问题:C# ClassLoaderWrapper.LoadClassByDottedName方法的具体用法?C# ClassLoaderWrapper.LoadClassByDottedName怎么用?C# ClassLoaderWrapper.LoadClassByDottedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoaderWrapper
的用法示例。
在下文中一共展示了ClassLoaderWrapper.LoadClassByDottedName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
internal static void Create(ModuleBuilder modb, ClassLoaderWrapper loader)
{
TypeBuilder tb = modb.DefineType(DotNetTypeWrapper.GenericDelegateInterfaceTypeName, TypeAttributes.Interface | TypeAttributes.Abstract | TypeAttributes.Public);
tb.DefineGenericParameters("T")[0].SetBaseTypeConstraint(Types.MulticastDelegate);
genericDelegateInterfaceType = tb.CreateType();
TypeWrapper annotationTypeWrapper = loader.LoadClassByDottedName("java.lang.annotation.Annotation");
annotationTypeWrapper.Finish();
genericAttributeAnnotationType = CreateAnnotationType(modb, DotNetTypeWrapper.GenericAttributeAnnotationTypeName, annotationTypeWrapper);
genericAttributeAnnotationMultipleType = CreateAnnotationType(modb, DotNetTypeWrapper.GenericAttributeAnnotationMultipleTypeName, annotationTypeWrapper);
genericAttributeAnnotationReturnValueType = CreateAnnotationType(modb, DotNetTypeWrapper.GenericAttributeAnnotationReturnValueTypeName, annotationTypeWrapper);
CreateEnumEnum(modb, loader);
}
示例2: Finish
internal static void Finish(ClassLoaderWrapper loader)
{
TypeBuilder tb = (TypeBuilder)genericEnumEnumType;
TypeWrapper enumTypeWrapper = loader.LoadClassByDottedName("java.lang.Enum");
enumTypeWrapper.Finish();
tb.SetParent(enumTypeWrapper.TypeAsBaseType);
CodeEmitter ilgen = CodeEmitter.Create(tb.DefineConstructor(MethodAttributes.Private, CallingConventions.Standard, new Type[] { Types.String, Types.Int32 }));
ilgen.Emit(OpCodes.Ldarg_0);
ilgen.Emit(OpCodes.Ldarg_1);
ilgen.Emit(OpCodes.Ldarg_2);
enumTypeWrapper.GetMethodWrapper("<init>", "(Ljava.lang.String;I)V", false).EmitCall(ilgen);
ilgen.Emit(OpCodes.Ret);
ilgen.DoEmit();
genericEnumEnumType = tb.CreateType();
}
示例3: CreateEnumEnum
private static void CreateEnumEnum(ModuleBuilder modb, ClassLoaderWrapper loader)
{
TypeWrapper enumTypeWrapper = loader.LoadClassByDottedName("java.lang.Enum");
enumTypeWrapper.Finish();
TypeBuilder tb = modb.DefineType(DotNetTypeWrapper.GenericEnumEnumTypeName, TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.Public, enumTypeWrapper.TypeAsBaseType);
GenericTypeParameterBuilder gtpb = tb.DefineGenericParameters("T")[0];
gtpb.SetBaseTypeConstraint(Types.Enum);
CodeEmitter ilgen = CodeEmitter.Create(tb.DefineConstructor(MethodAttributes.Private, CallingConventions.Standard, new Type[] { Types.String, Types.Int32 }));
ilgen.Emit(OpCodes.Ldarg_0);
ilgen.Emit(OpCodes.Ldarg_1);
ilgen.Emit(OpCodes.Ldarg_2);
enumTypeWrapper.GetMethodWrapper("<init>", "(Ljava.lang.String;I)V", false).EmitCall(ilgen);
ilgen.Emit(OpCodes.Ret);
genericEnumEnumType = tb.CreateType();
}
示例4: Emit
internal void Emit(ClassLoaderWrapper loader, CodeEmitter ilgen)
{
if(Type != "static" || Class == null || Name == null || Sig == null)
{
throw new NotImplementedException();
}
Type[] redirParamTypes = loader.ArgTypeListFromSig(Sig);
for(int i = 0; i < redirParamTypes.Length; i++)
{
ilgen.Emit(OpCodes.Ldarg, (short)i);
}
// HACK if the class name contains a comma, we assume it is a .NET type
if(Class.IndexOf(',') >= 0)
{
Type type = StaticCompiler.Universe.GetType(Class, true);
MethodInfo mi = type.GetMethod(Name, redirParamTypes);
if(mi == null)
{
throw new InvalidOperationException();
}
ilgen.Emit(OpCodes.Call, mi);
}
else
{
TypeWrapper tw = loader.LoadClassByDottedName(Class);
MethodWrapper mw = tw.GetMethodWrapper(Name, Sig, false);
if(mw == null)
{
throw new InvalidOperationException();
}
mw.Link();
mw.EmitCall(ilgen);
}
// TODO we may need a cast here (or a stack to return type conversion)
ilgen.Emit(OpCodes.Ret);
}
示例5: LoadTypes
private static TypeWrapper[] LoadTypes(ClassLoaderWrapper loader, string[] classes)
{
if (classes == null || classes.Length == 0)
{
return TypeWrapper.EmptyArray;
}
TypeWrapper[] tw = new TypeWrapper[classes.Length];
for (int i = 0; i < tw.Length; i++)
{
tw[i] = loader.LoadClassByDottedName(classes[i]);
}
return tw;
}