當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleBindings.put方法代碼示例

本文整理匯總了Java中javax.script.SimpleBindings.put方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleBindings.put方法的具體用法?Java SimpleBindings.put怎麽用?Java SimpleBindings.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.script.SimpleBindings的用法示例。


在下文中一共展示了SimpleBindings.put方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeScriptWithConsole

import javax.script.SimpleBindings; //導入方法依賴的package包/類
public Object executeScriptWithConsole(ScriptType type, String script, Map<String, Object> params, StringWriter console) {
    ScriptEngine scriptEngine = produceScriptEngine(type);

    if (console != null) {
        scriptEngine.getContext().setWriter(console);
    }

    SimpleBindings bindings = new SimpleBindings();
    bindings.putAll(params);
    bindings.put("spring", context);

    try {
        return scriptEngine.eval(script, bindings);
    } catch (ScriptException ex) {
        throw new GeneralException(ex);
    }
}
 
開發者ID:LIBCAS,項目名稱:ARCLib,代碼行數:18,代碼來源:ScriptExecutor.java

示例2: execute

import javax.script.SimpleBindings; //導入方法依賴的package包/類
private Object execute(MapAttribute wellKnowsAttributes) throws MetaException {
  try {
    SimpleBindings bindings = new SimpleBindings();
    bindings.put("attributes", wellKnowsAttributes);
    Invocable invocable = (Invocable)engines.getCachedEngine(javascriptPath);
    return invocable.invokeFunction("create", wellKnowsAttributes);
  } catch (ScriptException|NoSuchMethodException|IOException|URISyntaxException ex) {
    throw new MetaException("Error executing script.", ex);
  }
}
 
開發者ID:Esri,項目名稱:geoportal-server-harvester,代碼行數:11,代碼來源:BaseJSMetaBuilder.java

示例3: handle

import javax.script.SimpleBindings; //導入方法依賴的package包/類
@Override
public void handle(ByteBuf buf, MapleClient client) {
	buf.readByte();
       String startwp = readMapleAsciiString(buf);
       buf.readShort();
       MaplePortal portal = client.getCharacter().getMap().getPortal(startwp);
       if (portal == null) {
           client.sendReallowActions();
           return;
       }
       
       if(portal.isBlocked(client.getCharacter())){
       	client.sendReallowActions();
       	return;
       }
       
       if(client.getCharacter().getMapId() == 910000000){
       	client.getCharacter().changeMap(client.getCharacter().getFmReturnMap());
       }else if(portal.getTargetMapId() == 999999999){
       	MapleScript script = new MapleScript("scripts/portal/"+portal.getScriptName()+".js", "scripts/portal/fallback.js");
       	
       	PortalScriptManager pm = new PortalScriptManager(client.getCharacter(), portal);
       	client.getLogger().debug("Running portal script "+script.getFile().getPath());
       	SimpleBindings sb = new SimpleBindings();
       	sb.put("pm", pm);
       	try {
			script.execute(sb).startPortal();
		} catch (Exception e) {
			e.printStackTrace();
			client.getLogger().error("Error running script "+portal.getScriptName());
		}
       	client.sendReallowActions();
       }else{
       	portal.enterPortal(client); 
       }
       
}
 
開發者ID:tylerhasman,項目名稱:MapleStory,代碼行數:38,代碼來源:ChangeMapSpecialHandler.java

示例4: openSimpleTextNpc

import javax.script.SimpleBindings; //導入方法依賴的package包/類
public void openSimpleTextNpc(String text){
	
	SimpleBindings sb = new SimpleBindings();
	sb.put("text", text);
	
	openNpc(new MapleScript("scripts/npc/simple_talk.js"), sb, MapleLifeFactory.getNPC(2080005));
	
}
 
開發者ID:tylerhasman,項目名稱:MapleStory,代碼行數:9,代碼來源:MapleCharacter.java


注:本文中的javax.script.SimpleBindings.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。