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


Java JSContext类代码示例

本文整理汇总了Java中com.ibm.jscript.JSContext的典型用法代码示例。如果您正苦于以下问题:Java JSContext类的具体用法?Java JSContext怎么用?Java JSContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getParamObject

import com.ibm.jscript.JSContext; //导入依赖的package包/类
private FBSObject getParamObject(JavaScriptInterpreter js, List<RpcArgument> args, ArrayObject params) throws InterpretException {
    JSContext context = js.getJSContext();
    FBSParams map = new FBSParams(context);
    if(args!=null) {
        for(int i = 0; i<args.size(); i++) {
            RpcArgument a = args.get(i);
            String name = a.getName();
            if(StringUtil.isNotEmpty(name)) {
                FBSValue v = i<params.getArrayLength() ? params.get(i) : FBSUndefined.undefinedValue;
                map.put(name, v);
            }
        }
    }
    map.put("arguments", params); // $NON-NLS-1$
    return map;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:17,代码来源:RemoteMethod.java

示例2: NotesFunctionsEx

import com.ibm.jscript.JSContext; //导入依赖的package包/类
public NotesFunctionsEx(JSContext jsContext) {

        super(jsContext, null, false);

        // Document helpers
        addFunction(FCT_TOPPARENTID, "@TopParentID", "(doc:W):T"); // $NON-NLS-1$ $NON-NLS-2$
        addFunction(FCT_TOPPARENTUNID, "@TopParentUNID", "(doc:W):T"); // $NON-NLS-1$ $NON-NLS-2$

        // URL handling
        addFunction(FCT_FULLURL, "@FullUrl", "(str:T):T", "(str:T, form:T):T"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
        addFunction(FCT_ABSOLUTEURL, "@AbsoluteUrl", "(str:T):T"); // $NON-NLS-1$ $NON-NLS-2$
        addFunction(FCT_ENCODEURL, "@EncodeUrl", "(str:T):T"); // $NON-NLS-1$ $NON-NLS-2$
        addFunction(FCT_ISABSOLUTEURL, "@IsAbsoluteUrl", "(str:T):T"); // $NON-NLS-1$ $NON-NLS-2$

        // XPages helpers
        addFunction(FCT_ERRORMESSAGE, "@ErrorMessage", "(str:Tcomp:W):V"); // $NON-NLS-1$ $NON-NLS-2$
        addFunction(FCT_WARNINGMESSAGE, "@WarningMessage", "(str:Tcomp:W):V"); // $NON-NLS-1$ $NON-NLS-2$
        addFunction(FCT_INFORMATIONMESSAGE, "@InfoMessage", "(str:Tcomp:W):V"); // $NON-NLS-1$ $NON-NLS-2$

        // Domino View
        addFunction(FCT_VIEWICONURL, "@ViewIconUrl", "(icon:I):T"); // $NON-NLS-1$ $NON-NLS-2$

        addFunction(FCT_NORMALIZESUBJECT, "@NormalizeSubject", "(subject:T):T", "(subject:T, maxlength:I):T"); // $NON-NLS-1$ // $NON-NLS-2$ // $NON-NLS-3$
    }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:25,代码来源:NotesFunctionsEx.java

示例3: register

import com.ibm.jscript.JSContext; //导入依赖的package包/类
/**
 * Registers the methods of all Java classes in {@link WrapperOpenDomino#WRAPPED_CLASSES}, prefixing them with "Open"
 * 
 * @param context
 *            JSContext in which methods will be registered
 * @since org.openntf.domino.xsp 2.5.0
 */
public static void register(final JSContext context) {
	if (registered) {
		return;
	}

	try {
		Registry registry = context.getRegistry();
		registry.registerPackage("OpenNTFDomino", 1337);
		FBSDefaultObject defaultObject = registry.getRegistryObject();

		List<Object> wregs = ExtensionManager.findServices(null, WrapperOpenDomino.class, WrapperRegistry.class.getName());
		// for (Class<?> clazz : WRAPPED_CLASSES) {
		for (Object wreg : wregs) {
			for (Class<?> clazz : ((WrapperRegistry) wreg).getWrapperClasses()) {
				registry.registerWrapper(clazz, new OpenWrapperFactory(clazz));
				defaultObject.createProperty("Open" + clazz.getSimpleName(), 1338, new OpenConstructor(context, clazz));
			}
		}

	} catch (Exception e) {
		e.printStackTrace();
	}
	registered = true;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:32,代码来源:WrapperOpenDomino.java

示例4: registerWrappers

import com.ibm.jscript.JSContext; //导入依赖的package包/类
@Override
public void registerWrappers(JSContext jsContext) {
    // so that the SSJS editor in Designer can find the methods 
    // on the bluemixContext global object.
    // [The global object itself is already registered through
    //  BluemixContextImplicitObjectFactory.getImplicitObjectList() ]
    ClassLoader designCl = this.getClass().getClassLoader(); 
    jsContext.addDesignTimeClassLoader(new FBSType.SimpleDesignTimeClassLoader(designCl));
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:10,代码来源:DesignTimeJSProvider.java

示例5: NotesFunction

import com.ibm.jscript.JSContext; //导入依赖的package包/类
NotesFunction(JSContext jsContext, int index, String functionName, String[] params) {

            super(jsContext);
            this.functionName = functionName;
            this.index = index;
            this.params = params;
        }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:8,代码来源:NotesFunctionsEx.java

示例6: JdbcFunctions

import com.ibm.jscript.JSContext; //导入依赖的package包/类
public JdbcFunctions(JSContext jsContext) {

        super(jsContext, null, false);

        addFunction(FCT_GETCONNECTION, "@JdbcGetConnection", "(data:T):Ljava.sql.Connection;"); // $NON-NLS-1$ $NON-NLS-2$
        addFunction(FCT_DBCOLUMN, "@JdbcDbColumn", "(connection:Wtable:Tcolumn:T):A", "(connection:Wtable:Tcolumn:Twhere:T):A", "(connection:Wtable:Tcolumn:Twhere:TorderBy:T):A","(connection:Wtable:Tcolumn:Twhere:TorderBy:Tparams:A):A"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$ $NON-NLS-5$
        addFunction(FCT_EXECUTEQUERY, "@JdbcExecuteQuery", "(connection:Wsql:T):Ljava.sql.ResultSet;", "(connection:Wsql:Tparams:A):Ljava.sql.ResultSet;"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
        addFunction(FCT_INSERT, "@JdbcInsert", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:WcolumnNames:A):I", "(connection:Wtable:Tvalues:WcolumnNames:AcolToUpperCase:Z):I"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$
        addFunction(FCT_UPDATE, "@JdbcUpdate", "(connection:Wtable:Tvalues:W):I", "(connection:Wtable:Tvalues:Wwhere:T):I", "(connection:Wtable:Tvalues:Wwhere:Tparams:A):I", "(connection:Wtable:Tvalues:Wwhere:Tparams:AcolToUpperCase:Z):I"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ $NON-NLS-4$ $NON-NLS-5$
        addFunction(FCT_DELETE, "@JdbcDelete", "(connection:Wtable:Twhere:T):I", "(connection:Wtable:Twhere:Tparams:A):I"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
    }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:12,代码来源:JdbcFunctions.java

示例7: NotesFunction

import com.ibm.jscript.JSContext; //导入依赖的package包/类
NotesFunction(JSContext jsContext, int index,
        String functionName, String[] params) {

    super(jsContext);
    this.functionName = functionName;
    this.index = index;
    this.params = params;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:9,代码来源:JdbcFunctions.java

示例8: NotesFunction

import com.ibm.jscript.JSContext; //导入依赖的package包/类
NotesFunction(JSContext jsContext, int index, String functionName, String[] params) {

			super(jsContext);
			this.functionName = functionName;
			this.index = index;
			this.params = params;

		}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:9,代码来源:XPTNotesFunctionsEx.java

示例9: generateMethodMap

import com.ibm.jscript.JSContext; //导入依赖的package包/类
/**
 * Generates the map of all methods in the class where the key is the method name and the value is a new OpenFunction for the method<br/>
 * 
 * @param context
 *            JSContext in which to register the method
 * @param clazz
 *            Class from which to register methods
 * @return OpenMethodMap, a hash map of methods from the class
 * @since org.openntf.domino.xsp 2.5.0
 */
private static OpenMethodMap generateMethodMap(final JSContext context, final Class<?> clazz) {
	OpenMethodMap methodMap = new OpenMethodMap(context, clazz, null);
	for (Method crystal : clazz.getMethods()) {
		if (Modifier.isPublic(crystal.getModifiers()) && !Modifier.isStatic(crystal.getModifiers())) {
			String name = crystal.getName();
			Object cur = methodMap.get(name);
			if (cur == null) {
				// Method does not exist in map
				cur = new OpenFunction(context, crystal);
				methodMap.put(crystal.getName(), cur);
			}
			if (cur instanceof OpenFunction) {
				((OpenFunction) cur).addMethod(crystal);
			} else {
				// We get here if we add a method that's the same as an existing lotus.domino one
				try {
					if ("function:IBMJS built-in function".equals(cur.toString())) {
						methodMap.put(crystal.getName(), new OpenFunction(context, crystal));
					} else {
						System.out.println("Something's gone wrong! " + name + ": " + cur.toString() + ">" + cur.getClass().getName());
					}
				} catch (Throwable t) {
					// System.out.println("Hit error on " + name);
				}
			}
		}
	}
	synchronized (WrapperOpenDomino.class) {
		classMap_.put(clazz, methodMap);
	}
	return methodMap;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:43,代码来源:WrapperOpenDomino.java

示例10: FBSParams

import com.ibm.jscript.JSContext; //导入依赖的package包/类
FBSParams(JSContext context) {
    super(context);
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:4,代码来源:RemoteMethod.java

示例11: registerWrappers

import com.ibm.jscript.JSContext; //导入依赖的package包/类
public void registerWrappers(JSContext jsContext) {
    jsContext.getRegistry().registerGlobalPrototype("@FunctionsEx", new NotesFunctionsEx(jsContext)); // $NON-NLS-1$
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:4,代码来源:ExtendedDominoJSFunctions.java

示例12: getJSContext

import com.ibm.jscript.JSContext; //导入依赖的package包/类
protected JSContext getJSContext() {
    return DesignerRuntime.getJSContext();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:4,代码来源:JavaScriptDumpFactory.java

示例13: JSObject

import com.ibm.jscript.JSContext; //导入依赖的package包/类
public JSObject(DumpContext dumpContext, JSContext context, FBSObject value) {
    super(dumpContext);
    this.context = context;
    this.value = value;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:6,代码来源:JavaScriptDumpFactory.java

示例14: registerWrappers

import com.ibm.jscript.JSContext; //导入依赖的package包/类
public void registerWrappers(JSContext jsContext) {
    jsContext.getRegistry().registerGlobalPrototype("@Jdbc", new JdbcFunctions(jsContext)); // $NON-NLS-1$
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:4,代码来源:JdbcJSFunctions.java

示例15: registerWrappers

import com.ibm.jscript.JSContext; //导入依赖的package包/类
public void registerWrappers(JSContext jsContext) {
    jsContext.getRegistry().registerGlobalPrototype("@XPTFunctions", new XPTNotesFunctionsEx(jsContext)); // $NON-NLS-1$
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:4,代码来源:XPTExtDominoJSFunctions.java


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