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


C# Context.GetApplicationClassLoader方法代码示例

本文整理汇总了C#中Rhino.Context.GetApplicationClassLoader方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetApplicationClassLoader方法的具体用法?C# Context.GetApplicationClassLoader怎么用?C# Context.GetApplicationClassLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rhino.Context的用法示例。


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

示例1: Init

		public static void Init(Context cx, Scriptable scope, bool @sealed)
		{
			ClassLoader loader = cx.GetApplicationClassLoader();
			Rhino.NativeJavaTopPackage top = new Rhino.NativeJavaTopPackage(loader);
			top.SetPrototype(GetObjectPrototype(scope));
			top.SetParentScope(scope);
			for (int i = 0; i != commonPackages.Length; i++)
			{
				NativeJavaPackage parent = top;
				for (int j = 0; j != commonPackages[i].Length; j++)
				{
					parent = parent.ForcePackage(commonPackages[i][j], scope);
				}
			}
			// getClass implementation
			IdFunctionObject getClass = new IdFunctionObject(top, FTAG, Id_getClass, "getClass", 1, scope);
			// We want to get a real alias, and not a distinct JavaPackage
			// with the same packageName, so that we share classes and top
			// that are underneath.
			string[] topNames = ScriptRuntime.GetTopPackageNames();
			NativeJavaPackage[] topPackages = new NativeJavaPackage[topNames.Length];
			for (int i_1 = 0; i_1 < topNames.Length; i_1++)
			{
				topPackages[i_1] = (NativeJavaPackage)top.Get(topNames[i_1], top);
			}
			// It's safe to downcast here since initStandardObjects takes
			// a ScriptableObject.
			ScriptableObject global = (ScriptableObject)scope;
			if (@sealed)
			{
				getClass.SealObject();
			}
			getClass.ExportAsScopeProperty();
			global.DefineProperty("Packages", top, ScriptableObject.DONTENUM);
			for (int i_2 = 0; i_2 < topNames.Length; i_2++)
			{
				global.DefineProperty(topNames[i_2], topPackages[i_2], ScriptableObject.DONTENUM);
			}
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:39,代码来源:NativeJavaTopPackage.cs


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