本文整理了Java中io.helidon.config.Config.asOptional()
方法的一些代码示例,展示了Config.asOptional()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.asOptional()
方法的具体详情如下:
包路径:io.helidon.config.Config
类名称:Config
方法名:asOptional
暂无
代码示例来源:origin: io.helidon.security/helidon-security-provider-header-atn
/**
* Load this builder from a configuration.
*
* @param config configuration to load from
* @return updated builder instance
*/
public Builder fromConfig(Config config) {
config.get("optional").asOptional(Boolean.class).ifPresent(this::optional);
config.get("authenticate").asOptional(Boolean.class).ifPresent(this::authenticate);
config.get("propagate").asOptional(Boolean.class).ifPresent(this::propagate);
config.get("principal-type").asOptional(SubjectType.class).ifPresent(this::subjectType);
config.get("atn-token").asOptional(TokenHandler.class).ifPresent(this::atnTokenHandler);
config.get("outbound-token").asOptional(TokenHandler.class).ifPresent(this::outboundTokenHandler);
return this;
}
代码示例来源:origin: io.helidon.security/helidon-security-providers-common
evictSchedule(evictDelay, evictPeriod, TimeUnit.MILLISECONDS);
config.get("parallelism-treshold").asOptionalLong().ifPresent(this::parallelismThreshold);
config.get("evictor-class").asOptional(Class.class).ifPresent(this::evictorClass);
代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver
OptionalHelper.from(config.get(KEY_AUTHORIZER).value()).or(() -> defaults.explicitAuthorizer).asOptional()
.ifPresent(builder::authorizer);
OptionalHelper.from(config.get(KEY_AUTHENTICATE).asOptional(Boolean.class)).or(() -> defaults.authenticate).asOptional()
.ifPresent(builder::authenticate);
OptionalHelper.from(config.get(KEY_AUTHENTICATION_OPTIONAL).asOptional(Boolean.class))
.or(() -> defaults.authenticationOptional)
.asOptional().ifPresent(builder::authenticationOptional);
OptionalHelper.from(config.get(KEY_AUDIT).asOptional(Boolean.class)).or(() -> defaults.audited).asOptional()
.ifPresent(builder::audit);
OptionalHelper.from(config.get(KEY_AUTHORIZE).asOptional(Boolean.class)).or(() -> defaults.authorize).asOptional()
.ifPresent(builder::authorize);
OptionalHelper.from(config.get(KEY_AUDIT_EVENT_TYPE).value()).or(() -> defaults.auditEventType).asOptional()
config.get(KEY_AUTHENTICATION_OPTIONAL).asOptional(Boolean.class).ifPresent(aBoolean -> {
if (aBoolean) {
if (!config.get(KEY_AUTHENTICATE).exists()) {
代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver
private static <T> void configure(Config config,
String key,
Optional<T> defaultValue,
Consumer<T> builderMethod,
Class<T> clazz) {
OptionalHelper.from(config.get(key).asOptional(clazz)).or(() -> defaultValue).asOptional().ifPresent(builderMethod);
}
内容来源于网络,如有侵权,请联系作者删除!