io.helidon.config.Config.name()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(156)

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

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:

  • from a Type#OBJECT node the token for a child is the name of the object member;
  • from a Type#LIST node the token for a child is a zero-based index of the element, an unsigned base-10 integer value with no leading zeros.

The ABNF syntax of config key is:

  1. config-key = *1( key-token *( "." key-token ) )

[中]返回Confignode的完全限定密钥的最后一个令牌。
节点的名称是其完全限定密钥中的最后一个令牌。
名称的确切格式取决于包含节点的类型:
*在类型#对象节点中,子节点的标记是对象成员的名称;
*在类型#列表节点中,子元素的标记是元素的一个从零开始的索引,一个无符号的以10为基数的整数值,没有前导零。
配置键的ABNF语法为:

  1. config-key = *1( key-token *( "." key-token ) )

代码示例

代码示例来源:origin: oracle/helidon

  1. private boolean notReservedProviderKey(Config config) {
  2. return !RESERVED_PROVIDER_KEYS.contains(config.name());
  3. }

代码示例来源:origin: oracle/helidon

  1. private SecurityHandler(Builder builder) {
  2. // must copy values to be safely immutable
  3. this.rolesAllowed = builder.rolesAllowed.flatMap(strings -> {
  4. Set<String> newRoles = new HashSet<>(strings);
  5. return Optional.of(newRoles);
  6. });
  7. // must copy values to be safely immutable
  8. this.customObjects = builder.customObjects.flatMap(store -> {
  9. ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>();
  10. ctis.putAll(store);
  11. return Optional.of(ctis);
  12. });
  13. config = builder.config;
  14. explicitAuthenticator = builder.explicitAuthenticator;
  15. explicitAuthorizer = builder.explicitAuthorizer;
  16. authenticate = builder.authenticate;
  17. authenticationOptional = builder.authenticationOptional;
  18. audited = builder.audited;
  19. auditEventType = builder.auditEventType;
  20. auditMessageFormat = builder.auditMessageFormat;
  21. authorize = builder.authorize;
  22. combined = builder.combined;
  23. queryParamHandlers.addAll(builder.queryParamHandlers);
  24. config.ifPresent(conf -> conf.asNodeList().get().forEach(node -> configMap.put(node.name(), node)));
  25. }

代码示例来源:origin: oracle/helidon

  1. private String resolveProviderName(Config pConf,
  2. String className,
  3. Config providerSpecificConfig,
  4. SecurityProviderService providerService) {
  5. return pConf.get("name").asString().orElseGet(() -> {
  6. if (null == providerSpecificConfig) {
  7. if (null == className) {
  8. return providerService.providerClass().getSimpleName();
  9. } else {
  10. int index = className.indexOf('.');
  11. if (index > -1) {
  12. return className.substring(index + 1);
  13. }
  14. return className;
  15. }
  16. } else {
  17. return providerSpecificConfig.name();
  18. }
  19. });
  20. }

代码示例来源:origin: oracle/helidon

  1. private void findProviderService(Map<String, SecurityProviderService> configKeyToService,
  2. String knownKeys,
  3. Config pConf,
  4. AtomicReference<SecurityProviderService> service,
  5. AtomicReference<Config> providerSpecific) {
  6. // everything else is based on provider specific configuration
  7. pConf.asNodeList().get().stream().filter(this::notReservedProviderKey).forEach(providerSpecificConf -> {
  8. if (!providerSpecific.compareAndSet(null, providerSpecificConf)) {
  9. throw new SecurityException("More than one provider configurations found, each provider can only"
  10. + " have one provider specific config. Conflict: "
  11. + providerSpecific.get().key()
  12. + " and " + providerSpecificConf.key());
  13. }
  14. String keyName = providerSpecificConf.name();
  15. if (configKeyToService.containsKey(keyName)) {
  16. service.set(configKeyToService.get(keyName));
  17. } else {
  18. throw new SecurityException("Configuration key " + providerSpecificConf.key()
  19. + " is not a valid provider configuration. Supported keys: "
  20. + knownKeys);
  21. }
  22. });
  23. }

代码示例来源:origin: oracle/helidon

  1. if (socketsConfig.exists()) {
  2. for (Config socketConfig : socketsConfig.asNodeList().orElse(CollectionsHelper.listOf())) {
  3. String socketName = socketConfig.name();
  4. sockets.put(socketName, configureSocket(socketConfig, SocketConfiguration.builder()).build());

代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver

  1. private SecurityHandler(Builder builder) {
  2. // must copy values to be safely immutable
  3. this.rolesAllowed = builder.rolesAllowed.flatMap(strings -> {
  4. Set<String> newRoles = new HashSet<>(strings);
  5. return Optional.of(newRoles);
  6. });
  7. // must copy values to be safely immutable
  8. this.customObjects = builder.customObjects.flatMap(store -> {
  9. ClassToInstanceStore<Object> ctis = new ClassToInstanceStore<>();
  10. ctis.putAll(store);
  11. return Optional.of(ctis);
  12. });
  13. config = builder.config;
  14. explicitAuthenticator = builder.explicitAuthenticator;
  15. explicitAuthorizer = builder.explicitAuthorizer;
  16. authenticate = builder.authenticate;
  17. authenticationOptional = builder.authenticationOptional;
  18. audited = builder.audited;
  19. auditEventType = builder.auditEventType;
  20. auditMessageFormat = builder.auditMessageFormat;
  21. authorize = builder.authorize;
  22. combined = builder.combined;
  23. queryParamHandlers.addAll(builder.queryParamHandlers);
  24. config.ifPresent(conf -> conf.asNodeList().forEach(node -> configMap.put(node.name(), node)));
  25. }

相关文章