本文整理了Java中ratpack.func.Action.noopIfNull()
方法的一些代码示例,展示了Action.noopIfNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.noopIfNull()
方法的具体详情如下:
包路径:ratpack.func.Action
类名称: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);
}
内容来源于网络,如有侵权,请联系作者删除!