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


Java InternalContextAdapter.put方法代码示例

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


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

示例1: render

import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render( InternalContextAdapter context, Writer writer, org.apache.velocity.runtime.parser.node.Node node ) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
    String var = node.jjtGetChild( 0 ).getFirstToken().image.substring( 1 );
    Node document = ( Node ) node.jjtGetChild( 1 ).value( context );
    String xpath = String.valueOf( node.jjtGetChild( 2 ).value( context ) );
    XPath xPath = XPathFactory.newInstance().newXPath();
    try {
        Node element = ( Node ) xPath.evaluate( xpath, document, XPathConstants.NODE );
        if( element != null )
            if( TEXT_NODES.contains( element.getNodeType() ) )
                context.put( var, element.getTextContent() );
            else context.put( var, element );
        else log.warn( "for " + xpath + " nothing found" );
    } catch( XPathExpressionException e ) {
        throw new IOException( "cannot evaluate xpath: " + e.getMessage() );
    }
    return true;
}
 
开发者ID:oaplatform,项目名称:oap,代码行数:18,代码来源:XPathDirective.java

示例2: render

import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node)
		throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
	StringWriter sw = new StringWriter();
	node.jjtGetChild(1).render(context, sw);
	// store the contents against the variable
	context.put("body_content", sw.toString());
	return super.render(context, writer, node);
}
 
开发者ID:robertjanetzko,项目名称:LegendsBrowser,代码行数:9,代码来源:Decorate.java

示例3: render

import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException
{
	StringWriter sw = new StringWriter();
	node.jjtGetChild(1).render(context, sw);

	// store the contents against the variable
	context.put("body_content", sw.toString());

	return super.render(context, writer, node);
}
 
开发者ID:simoncurd,项目名称:hula-web,代码行数:11,代码来源:Decorate.java

示例4: clean

import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
protected void clean(InternalContextAdapter context,
    Object o, ParameterMappingCollector collector, String savedItemKey) {
  if (o != null) {
    context.put(this.var, o);
  } else {
    context.remove(this.var);
  }
  collector.setItemKey(savedItemKey);
  postRender(context);
}
 
开发者ID:mybatis,项目名称:velocity-scripting,代码行数:11,代码来源:RepeatDirective.java

示例5: render

import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
	if(node.jjtGetNumChildren() != 1){
		throw new RuntimeException(getName() + " only and must accept one Map parameter!") ;
	}
	
	Map params = (Map) node.jjtGetChild(0).value(context) ;
	
	Object business = params.get("business") ;
	String ghostName ;
	
	if(business instanceof java.lang.String){
		ghostName = (String) business ;
	}else{
		ghostName = business.getClass().getName() ;
	}
	
	String var = (String) params.get("var") ;
	Object tableCondition = params.get("tableCondition") ;
	Object limit = params.get("limit") ;
	
	Assert.assertResouceNotNull(ghostName, "parameter [business] in Map is requried.") ;
	Assert.assertResouceNotNull(var, "parameter [var] in Map is requried.") ;
	
	LinkedList conditions = new LinkedList() ;
	
	BoundaryChain chain = (BoundaryChain) context.get(GuzzBoundaryDirective.BOUNDARY_CONTEXT_NAME) ;
	if(chain != null){
		if(tableCondition == null){
			tableCondition = chain.getTableCondition() ;
		}
		
		conditions.addAll(chain.getBoundaryLimits()) ;
	}
	
	if(limit != null){
		conditions.addLast(limit) ;
	}
	
	Business bi = guzzContext.getBusiness(ghostName) ;
	ObjectMapping mapping = guzzContext.getObjectMappingManager().getObjectMapping(ghostName, tableCondition) ;
	
	if(bi == null){
		throw new ParseErrorException("unknown business:[" + business + "], business name:" + ghostName) ;
	}		
			
	Object result = innerSummonGhosts(bi, mapping, tableCondition, conditions, params);
	
	//保存结果
	context.put(var, result) ;
       
       return true;
}
 
开发者ID:ryanwli,项目名称:guzz,代码行数:53,代码来源:SummonDirective.java

示例6: put

import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
protected void put(InternalContextAdapter context, String key, Object value) {
  context.put(key, value);
}
 
开发者ID:mybatis,项目名称:velocity-scripting,代码行数:4,代码来源:RepeatDirective.java


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