本文整理了Java中io.helidon.config.Config.name()
方法的一些代码示例,展示了Config.name()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.name()
方法的具体详情如下:
包路径:io.helidon.config.Config
类名称:Config
方法名:name
[英]Returns the last token of the fully-qualified key for the Confignode.
The name of a node is the last token in its fully-qualified key.
The exact format of the name depends on the Type of the containing node:
The ABNF syntax of config key is:
config-key = *1( key-token *( "." key-token ) )
[中]返回Confignode的完全限定密钥的最后一个令牌。
节点的名称是其完全限定密钥中的最后一个令牌。
名称的确切格式取决于包含节点的类型:
*在类型#对象节点中,子节点的标记是对象成员的名称;
*在类型#列表节点中,子元素的标记是元素的一个从零开始的索引,一个无符号的以10为基数的整数值,没有前导零。
配置键的ABNF语法为:
config-key = *1( key-token *( "." key-token ) )
代码示例来源:origin: oracle/helidon
private boolean notReservedProviderKey(Config config) {
return !RESERVED_PROVIDER_KEYS.contains(config.name());
}
代码示例来源:origin: oracle/helidon
private SecurityHandler(Builder builder) {
// must copy values to be safely immutable
this.rolesAllowed = builder.rolesAllowed.flatMap(strings -> {
Set<String> newRoles = new HashSet<>(strings);
return Optional.of(newRoles);
});
// must copy values to be safely immutable
this.customObjects = builder.customObjects.flatMap(store -> {
ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>();
ctis.putAll(store);
return Optional.of(ctis);
});
config = builder.config;
explicitAuthenticator = builder.explicitAuthenticator;
explicitAuthorizer = builder.explicitAuthorizer;
authenticate = builder.authenticate;
authenticationOptional = builder.authenticationOptional;
audited = builder.audited;
auditEventType = builder.auditEventType;
auditMessageFormat = builder.auditMessageFormat;
authorize = builder.authorize;
combined = builder.combined;
queryParamHandlers.addAll(builder.queryParamHandlers);
config.ifPresent(conf -> conf.asNodeList().get().forEach(node -> configMap.put(node.name(), node)));
}
代码示例来源:origin: oracle/helidon
private String resolveProviderName(Config pConf,
String className,
Config providerSpecificConfig,
SecurityProviderService providerService) {
return pConf.get("name").asString().orElseGet(() -> {
if (null == providerSpecificConfig) {
if (null == className) {
return providerService.providerClass().getSimpleName();
} else {
int index = className.indexOf('.');
if (index > -1) {
return className.substring(index + 1);
}
return className;
}
} else {
return providerSpecificConfig.name();
}
});
}
代码示例来源:origin: oracle/helidon
private void findProviderService(Map<String, SecurityProviderService> configKeyToService,
String knownKeys,
Config pConf,
AtomicReference<SecurityProviderService> service,
AtomicReference<Config> providerSpecific) {
// everything else is based on provider specific configuration
pConf.asNodeList().get().stream().filter(this::notReservedProviderKey).forEach(providerSpecificConf -> {
if (!providerSpecific.compareAndSet(null, providerSpecificConf)) {
throw new SecurityException("More than one provider configurations found, each provider can only"
+ " have one provider specific config. Conflict: "
+ providerSpecific.get().key()
+ " and " + providerSpecificConf.key());
}
String keyName = providerSpecificConf.name();
if (configKeyToService.containsKey(keyName)) {
service.set(configKeyToService.get(keyName));
} else {
throw new SecurityException("Configuration key " + providerSpecificConf.key()
+ " is not a valid provider configuration. Supported keys: "
+ knownKeys);
}
});
}
代码示例来源:origin: oracle/helidon
if (socketsConfig.exists()) {
for (Config socketConfig : socketsConfig.asNodeList().orElse(CollectionsHelper.listOf())) {
String socketName = socketConfig.name();
sockets.put(socketName, configureSocket(socketConfig, SocketConfiguration.builder()).build());
代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver
private SecurityHandler(Builder builder) {
// must copy values to be safely immutable
this.rolesAllowed = builder.rolesAllowed.flatMap(strings -> {
Set<String> newRoles = new HashSet<>(strings);
return Optional.of(newRoles);
});
// must copy values to be safely immutable
this.customObjects = builder.customObjects.flatMap(store -> {
ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>();
ctis.putAll(store);
return Optional.of(ctis);
});
config = builder.config;
explicitAuthenticator = builder.explicitAuthenticator;
explicitAuthorizer = builder.explicitAuthorizer;
authenticate = builder.authenticate;
authenticationOptional = builder.authenticationOptional;
audited = builder.audited;
auditEventType = builder.auditEventType;
auditMessageFormat = builder.auditMessageFormat;
authorize = builder.authorize;
combined = builder.combined;
queryParamHandlers.addAll(builder.queryParamHandlers);
config.ifPresent(conf -> conf.asNodeList().forEach(node -> configMap.put(node.name(), node)));
}
内容来源于网络,如有侵权,请联系作者删除!