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

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

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

Config.empty介绍

[英]Returns empty instance of Config.
[中]返回配置的空实例。

代码示例

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

  1. static RegistryFactory create() {
  2. return create(Config.empty());
  3. }

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

  1. private JwtOutboundTarget toOutboundTarget(OutboundTarget outboundTarget) {
  2. // first check if a custom object is defined
  3. Optional<? extends JwtOutboundTarget> customObject = outboundTarget.customObject(JwtOutboundTarget.class);
  4. if (customObject.isPresent()) {
  5. return customObject.get();
  6. }
  7. return JwtOutboundTarget.fromConfig(outboundTarget.getConfig()
  8. .orElse(Config.empty()), defaultTokenHandler);
  9. }

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

  1. private JwtOutboundTarget toOutboundTarget(OutboundTarget outboundTarget) {
  2. // first check if a custom object is defined
  3. Optional<? extends JwtOutboundTarget> customObject = outboundTarget.customObject(JwtOutboundTarget.class);
  4. if (customObject.isPresent()) {
  5. return customObject.get();
  6. }
  7. return JwtOutboundTarget.create(outboundTarget.getConfig()
  8. .orElse(Config.empty()), defaultTokenHandler);
  9. }

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

  1. @SuppressWarnings("ParameterNumber")
  2. ProviderImpl(ConfigMapperManager configMapperManager,
  3. ConfigSource configSource,
  4. OverrideSource overrideSource,
  5. List<Function<Config, ConfigFilter>> filterProviders,
  6. boolean cachingEnabled,
  7. Executor changesExecutor,
  8. int changesMaxBuffer,
  9. boolean keyResolving) {
  10. this.configMapperManager = configMapperManager;
  11. this.configSource = configSource;
  12. this.overrideSource = overrideSource;
  13. this.filterProviders = Collections.unmodifiableList(filterProviders);
  14. this.cachingEnabled = cachingEnabled;
  15. this.changesExecutor = changesExecutor;
  16. this.lastConfigsDiff = null;
  17. this.lastConfig = Config.empty();
  18. this.keyResolving = keyResolving;
  19. changesSubmitter = new RepeatLastEventPublisher<>(changesExecutor, changesMaxBuffer);
  20. changesPublisher = ConfigHelper.suspendablePublisher(changesSubmitter,
  21. this::subscribeSources,
  22. this::cancelSourcesSubscriptions);
  23. configSourceChangeEventSubscriber = null;
  24. }

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

  1. @Override
  2. public Config get(Key key) {
  3. if (key.isRoot()) {
  4. return this;
  5. } else {
  6. return Config.empty().get(this.key).get(key);
  7. }
  8. }

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

  1. public <T> Function<T, Supplier<PollingStrategy>> apply(Config config, Class<T> targetType)
  2. throws ConfigMappingException, MissingValueException {
  3. Config properties = config.get(PROPERTIES_KEY) // use properties config node
  4. .asNode()
  5. .orElse(Config.empty(config)); // or empty config node
  6. return OptionalHelper.from(config.get(TYPE_KEY).asString() // `type` is specified
  7. .flatMap(type -> this
  8. .builtin(type, properties, targetType))) // return built-in polling strategy
  9. .or(() -> config.get(CLASS_KEY)
  10. .as(Class.class) // `class` is specified
  11. .flatMap(clazz -> custom(clazz, properties, targetType))) // return custom polling strategy
  12. .asOptional()
  13. .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted polling-strategy configuration."));
  14. }

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

  1. @Override
  2. public RetryPolicy apply(Config config) throws ConfigMappingException, MissingValueException {
  3. Config properties = config.get(PROPERTIES_KEY) // use properties config node
  4. .asNode()
  5. .orElse(Config.empty(config)); // or empty config node
  6. return OptionalHelper.from(config.get(TYPE_KEY).asString() // `type` is specified
  7. .flatMap(type -> this.builtin(type, properties))) // return built-in retry policy
  8. .or(() -> config.get(CLASS_KEY)
  9. .as(Class.class) // `class` is specified
  10. .flatMap(clazz -> custom(clazz, properties))) // return custom retry policy
  11. .asOptional()
  12. .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted retry-policy configuration."));
  13. }

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

  1. @Override
  2. public ConfigSource apply(Config config) throws ConfigMappingException, MissingValueException {
  3. Config properties = config.get(PROPERTIES_KEY) // use properties config node
  4. .asNode()
  5. .orElse(Config.empty(config)); // or empty config node
  6. return OptionalHelper.from(config.get(TYPE_KEY)
  7. .asString() // `type` is specified
  8. .flatMap(type -> OptionalHelper
  9. .from(builtin(type, properties)) // return built-in source
  10. .or(() -> providers(type, properties))
  11. .asOptional())) // or use sources - custom type to class mapping
  12. .or(() -> config.get(CLASS_KEY)
  13. .as(Class.class) // `class` is specified
  14. .flatMap(clazz -> custom(clazz, properties))) // return custom source
  15. .asOptional()
  16. .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted source configuration."));
  17. }

代码示例来源:origin: io.helidon.security.providers/helidon-security-providers-jwt

  1. private JwtOutboundTarget toOutboundTarget(OutboundTarget outboundTarget) {
  2. // first check if a custom object is defined
  3. Optional<? extends JwtOutboundTarget> customObject = outboundTarget.customObject(JwtOutboundTarget.class);
  4. if (customObject.isPresent()) {
  5. return customObject.get();
  6. }
  7. return JwtOutboundTarget.create(outboundTarget.getConfig()
  8. .orElse(Config.empty()), defaultTokenHandler);
  9. }

代码示例来源:origin: io.helidon.microprofile.jwt/helidon-microprofile-jwt-auth

  1. private JwtOutboundTarget toOutboundTarget(OutboundTarget outboundTarget) {
  2. // first check if a custom object is defined
  3. Optional<? extends JwtOutboundTarget> customObject = outboundTarget.customObject(JwtOutboundTarget.class);
  4. if (customObject.isPresent()) {
  5. return customObject.get();
  6. }
  7. return JwtOutboundTarget.fromConfig(outboundTarget.getConfig()
  8. .orElse(Config.empty()), defaultTokenHandler);
  9. }

代码示例来源:origin: io.helidon.config/helidon-config

  1. @SuppressWarnings("ParameterNumber")
  2. ProviderImpl(ConfigMapperManager configMapperManager,
  3. ConfigSource configSource,
  4. OverrideSource overrideSource,
  5. List<Function<Config, ConfigFilter>> filterProviders,
  6. boolean cachingEnabled,
  7. Executor changesExecutor,
  8. int changesMaxBuffer,
  9. boolean keyResolving) {
  10. this.configMapperManager = configMapperManager;
  11. this.configSource = configSource;
  12. this.overrideSource = overrideSource;
  13. this.filterProviders = Collections.unmodifiableList(filterProviders);
  14. this.cachingEnabled = cachingEnabled;
  15. this.changesExecutor = changesExecutor;
  16. this.lastConfigsDiff = null;
  17. this.lastConfig = Config.empty();
  18. this.keyResolving = keyResolving;
  19. changesSubmitter = new RepeatLastEventPublisher<>(changesExecutor, changesMaxBuffer);
  20. changesPublisher = ConfigHelper.suspendablePublisher(changesSubmitter,
  21. this::subscribeSources,
  22. this::cancelSourcesSubscriptions);
  23. configSourceChangeEventSubscriber = null;
  24. }

代码示例来源:origin: io.helidon.config/helidon-config

  1. @Override
  2. public Config get(Key key) {
  3. if (key.isRoot()) {
  4. return this;
  5. } else {
  6. return Config.empty().get(this.key).get(key);
  7. }
  8. }

代码示例来源:origin: io.helidon.config/helidon-config

  1. @Override
  2. public RetryPolicy apply(Config config) throws ConfigMappingException, MissingValueException {
  3. Config properties = config.get(PROPERTIES_KEY) // use properties config node
  4. .asNode()
  5. .orElse(Config.empty(config)); // or empty config node
  6. return OptionalHelper.from(config.get(TYPE_KEY).asString() // `type` is specified
  7. .flatMap(type -> this.builtin(type, properties))) // return built-in retry policy
  8. .or(() -> config.get(CLASS_KEY)
  9. .as(Class.class) // `class` is specified
  10. .flatMap(clazz -> custom(clazz, properties))) // return custom retry policy
  11. .asOptional()
  12. .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted retry-policy configuration."));
  13. }

代码示例来源:origin: io.helidon.config/helidon-config

  1. public <T> Function<T, Supplier<PollingStrategy>> apply(Config config, Class<T> targetType)
  2. throws ConfigMappingException, MissingValueException {
  3. Config properties = config.get(PROPERTIES_KEY) // use properties config node
  4. .asNode()
  5. .orElse(Config.empty(config)); // or empty config node
  6. return OptionalHelper.from(config.get(TYPE_KEY).asString() // `type` is specified
  7. .flatMap(type -> this
  8. .builtin(type, properties, targetType))) // return built-in polling strategy
  9. .or(() -> config.get(CLASS_KEY)
  10. .as(Class.class) // `class` is specified
  11. .flatMap(clazz -> custom(clazz, properties, targetType))) // return custom polling strategy
  12. .asOptional()
  13. .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted polling-strategy configuration."));
  14. }

代码示例来源:origin: io.helidon.config/helidon-config

  1. @Override
  2. public ConfigSource apply(Config config) throws ConfigMappingException, MissingValueException {
  3. Config properties = config.get(PROPERTIES_KEY) // use properties config node
  4. .asNode()
  5. .orElse(Config.empty(config)); // or empty config node
  6. return OptionalHelper.from(config.get(TYPE_KEY)
  7. .asString() // `type` is specified
  8. .flatMap(type -> OptionalHelper
  9. .from(builtin(type, properties)) // return built-in source
  10. .or(() -> providers(type, properties))
  11. .asOptional())) // or use sources - custom type to class mapping
  12. .or(() -> config.get(CLASS_KEY)
  13. .as(Class.class) // `class` is specified
  14. .flatMap(clazz -> custom(clazz, properties))) // return custom source
  15. .asOptional()
  16. .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted source configuration."));
  17. }

相关文章