当前位置: 首页>>代码示例>>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;未经允许,请勿转载。