本文整理汇总了Java中danta.api.ContextProcessor类的典型用法代码示例。如果您正苦于以下问题:Java ContextProcessor类的具体用法?Java ContextProcessor怎么用?Java ContextProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContextProcessor类属于danta.api包,在下文中一共展示了ContextProcessor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import danta.api.ContextProcessor; //导入依赖的package包/类
@Override
public List<String> execute(ExecutionContext executionContext, ContentModel contentModel)
throws AcceptsException, ProcessException {
List<String> currentProcessorChain = Collections.synchronizedList(new ArrayList<>());
for (List<ContextProcessor> processorsSamePriority : contextProcessors.values()) {
processorsSamePriority.parallelStream().forEach(processor -> {
try {
if (processor.accepts(executionContext)) {
processor.process(executionContext, contentModel);
currentProcessorChain.add(processor.getClass().getName());
}
} catch (Exception e) {
LOG.error("Exception in parallel stream execution", e);
throw new RuntimeException(e);
}
});
}
return currentProcessorChain;
}
示例2: bindProcessor
import danta.api.ContextProcessor; //导入依赖的package包/类
public void bindProcessor(ContextProcessor processor) {
List<ContextProcessor> contextProcessorsSamePriority = this.contextProcessors.get(processor.priority());
if (contextProcessorsSamePriority == null) {
contextProcessorsSamePriority = new ArrayList<>();
}
contextProcessorsSamePriority.add(processor);
contextProcessors.put(processor.priority(), contextProcessorsSamePriority);
}
示例3: unbindProcessor
import danta.api.ContextProcessor; //导入依赖的package包/类
public void unbindProcessor(ContextProcessor processor) {
List<ContextProcessor> contextProcessorsSamePriority = this.contextProcessors.get(processor.priority());
contextProcessorsSamePriority.remove(processor);
}