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

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

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

Action.noopIfNull介绍

[英]If the given action is null, returns #noop(), otherwise returns the given action.
[中]如果给定操作为null,则返回#noop(),否则返回给定操作。

代码示例

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

/**
 * A method to create an instance of the default implementation of TestHttpClient.
 * <p>
 * The settings provided can be overridden on a per request basis via {@link ratpack.test.http.TestHttpClient#requestSpec}.
 *
 * @param applicationUnderTest the Ratpack application to make requests against
 * @param requestConfigurer a {@link ratpack.func.Action} that will set up the {@link ratpack.http.client.RequestSpec} for all requests made through this instance of TestHttpClient
 * @return a http client which is configured to make requests against the provided ApplicationUnderTest
 */
static TestHttpClient testHttpClient(ApplicationUnderTest applicationUnderTest, @Nullable Action<? super RequestSpec> requestConfigurer) {
 return new DefaultTestHttpClient(applicationUnderTest, Action.noopIfNull(requestConfigurer));
}

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

/**
 * Creates a {@link ratpack.handling.Context#render(Object) renderable} Groovy based markup template.
 *
 * @param id the id/name of the template
 * @param type The content type of template
 * @param modelBuilder an action the builds a model map
 * @return a template
 */
public static MarkupTemplate groovyMarkupTemplate(String id, String type, Action<? super ImmutableMap.Builder<String, Object>> modelBuilder) {
 ImmutableMap<String, Object> model = uncheck(() -> Action.with(ImmutableMap.<String, Object>builder(), Action.noopIfNull(modelBuilder)).build());
 return groovyMarkupTemplate(model, id, type);
}

相关文章