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


Java GroovyCategorySupport.use方法代码示例

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


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

示例1: asListOfRows

import org.codehaus.groovy.runtime.GroovyCategorySupport; //导入方法依赖的package包/类
public static List<Row> asListOfRows(Parameters existsParameters, Closure<?> tableData) {
  context.set(new ArrayList<Row>());
  tableData.setDelegate(new ShareDataAwardDelegate(existsParameters));
  tableData.setResolveStrategy(Closure.DELEGATE_FIRST);

  GroovyCategorySupport.use(TableParser.class, tableData);
  List<Row> rows = context.get();
  
  if (rows.size() <= 1)
    throw new DslException("table requires at least 2 rows, first row for column names, the rest for the data.");
  
  if (rows.size() > 0){
    for (int i = 0; i < rows.size(); i++){
      rows.get(i).setRowHeader(rows.get(0));
    }
  }
  rows.remove(0);
  
  return rows;
}
 
开发者ID:detectiveframework,项目名称:detective,代码行数:21,代码来源:TableParser.java

示例2: run

import org.codehaus.groovy.runtime.GroovyCategorySupport; //导入方法依赖的package包/类
/** for testing only */
public Outcome run(final int max) {
    return GroovyCategorySupport.use(Continuable.categories, new Closure<Outcome>(null) {
        @Override
        public Outcome call() {
            int remaining = max;
            List<String> functions = new ArrayList<String>();
            Next n = Next.this;
            while(n.yield==null) {
                functions.add(n.f.getClass().getCanonicalName());
                if (--remaining == 0) {
                    int len = functions.size();
                    throw new AssertionError("Did not terminate; ran " + len + " steps ending with: " + functions.subList(len - 20, len));
                }
                n = n.step();
            }
            return n.yield;
        }
    });
}
 
开发者ID:cloudbees,项目名称:groovy-cps,代码行数:21,代码来源:Next.java

示例3: run0

import org.codehaus.groovy.runtime.GroovyCategorySupport; //导入方法依赖的package包/类
/**
 * Resumes this program by either returning the value from {@link Continuable#suspend(Object)} or
 * throwing an exception
 */
public Outcome run0(final Outcome cn, List<Class> categories) {
    return GroovyCategorySupport.use(categories, new Closure<Outcome>(null) {
        @Override
        public Outcome call() {
            Next n = cn.resumeFrom(e,k);

            while(n.yield==null) {
                if (interrupt!=null) {
                    // TODO: correctly reporting a source location requires every block to have the line number
                    n = new Next(new ThrowBlock(UNKNOWN, new ConstantBlock(interrupt), true),n.e,n.k);
                    interrupt = null;
                }
                n = n.step();
            }

            e = n.e;
            k = n.k;

            return n.yield;
        }
    });
}
 
开发者ID:cloudbees,项目名称:groovy-cps,代码行数:27,代码来源:Continuable.java

示例4: parse

import org.codehaus.groovy.runtime.GroovyCategorySupport; //导入方法依赖的package包/类
private static <T, R> R parse(BuilderDSL<T> builder, Closure<?> tableData, Function<Context<T>, R> result) {
    Context<T> c = new Context<>(builder);
    context.set(c);

    tableData.setResolveStrategy(Closure.DELEGATE_FIRST);
    tableData.setDelegate(new VariableResolvingDelegate());

    // If tableData.call() happens to call this method again, our global variable 'context'
    // gets all messed up - TODO: maybe a stack push/pop mechanism should be introduced
    GroovyCategorySupport.use(TableDSL.class, tableData);

    return result.apply(c);
}
 
开发者ID:jakubkolar,项目名称:autobuilder,代码行数:14,代码来源:TableDSL.java


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