ratpack.func.Action.curry()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中ratpack.func.Action.curry()方法的一些代码示例,展示了Action.curry()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.curry()方法的具体详情如下:
包路径:ratpack.func.Action
类名称:Action
方法名:curry

Action.curry介绍

[英]Creates a block that executes this action with the given value when called.
[中]创建一个在调用时使用给定值执行此操作的块。

代码示例

代码示例来源:origin: io.ratpack/ratpack-core

private void finalizeResponse(Iterator<Action<? super Response>> finalizers, Runnable then) {
 if (finalizers.hasNext()) {
  finalizers
   .next()
   .curry(this)
   .map(Operation::of)
   .then(() ->
    finalizeResponse(finalizers, then)
   );
 } else {
  finalizeResponse(then);
 }
}

代码示例来源:origin: io.ratpack/ratpack-exec

/**
 * Executes the given action with the promise value, on a blocking thread.
 * <p>
 * Similar to {@link #blockingMap(Function)}, but does not provide a new value.
 * This can be used to do something with the value, without terminating the promise.
 *
 * @param action the action to to perform with the value, on a blocking thread
 * @return a promise for the same value given to the action
 */
default Promise<T> blockingOp(Action<? super T> action) {
 return flatMap(t -> Blocking.op(action.curry(t)).map(() -> t));
}

相关文章