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

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

本文整理了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

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

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

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

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

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

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

@SuppressWarnings("ParameterNumber")
ProviderImpl(ConfigMapperManager configMapperManager,
       ConfigSource configSource,
       OverrideSource overrideSource,
       List<Function<Config, ConfigFilter>> filterProviders,
       boolean cachingEnabled,
       Executor changesExecutor,
       int changesMaxBuffer,
       boolean keyResolving) {
  this.configMapperManager = configMapperManager;
  this.configSource = configSource;
  this.overrideSource = overrideSource;
  this.filterProviders = Collections.unmodifiableList(filterProviders);
  this.cachingEnabled = cachingEnabled;
  this.changesExecutor = changesExecutor;
  this.lastConfigsDiff = null;
  this.lastConfig = Config.empty();
  this.keyResolving = keyResolving;
  changesSubmitter = new RepeatLastEventPublisher<>(changesExecutor, changesMaxBuffer);
  changesPublisher = ConfigHelper.suspendablePublisher(changesSubmitter,
                             this::subscribeSources,
                             this::cancelSourcesSubscriptions);
  configSourceChangeEventSubscriber = null;
}

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

@Override
public Config get(Key key) {
  if (key.isRoot()) {
    return this;
  } else {
    return Config.empty().get(this.key).get(key);
  }
}

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

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

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

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

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

@Override
public ConfigSource apply(Config config) throws ConfigMappingException, MissingValueException {
  Config properties = config.get(PROPERTIES_KEY) // use properties config node
      .asNode()
      .orElse(Config.empty(config)); // or empty config node
  return OptionalHelper.from(config.get(TYPE_KEY)
                    .asString() // `type` is specified
                    .flatMap(type -> OptionalHelper
                        .from(builtin(type, properties)) // return built-in source
                        .or(() -> providers(type, properties))
                        .asOptional())) // or use sources - custom type to class mapping
      .or(() -> config.get(CLASS_KEY)
          .as(Class.class) // `class` is specified
          .flatMap(clazz -> custom(clazz, properties))) // return custom source
      .asOptional()
      .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted source configuration."));
}

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

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

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

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

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

@SuppressWarnings("ParameterNumber")
ProviderImpl(ConfigMapperManager configMapperManager,
       ConfigSource configSource,
       OverrideSource overrideSource,
       List<Function<Config, ConfigFilter>> filterProviders,
       boolean cachingEnabled,
       Executor changesExecutor,
       int changesMaxBuffer,
       boolean keyResolving) {
  this.configMapperManager = configMapperManager;
  this.configSource = configSource;
  this.overrideSource = overrideSource;
  this.filterProviders = Collections.unmodifiableList(filterProviders);
  this.cachingEnabled = cachingEnabled;
  this.changesExecutor = changesExecutor;
  this.lastConfigsDiff = null;
  this.lastConfig = Config.empty();
  this.keyResolving = keyResolving;
  changesSubmitter = new RepeatLastEventPublisher<>(changesExecutor, changesMaxBuffer);
  changesPublisher = ConfigHelper.suspendablePublisher(changesSubmitter,
                             this::subscribeSources,
                             this::cancelSourcesSubscriptions);
  configSourceChangeEventSubscriber = null;
}

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

@Override
public Config get(Key key) {
  if (key.isRoot()) {
    return this;
  } else {
    return Config.empty().get(this.key).get(key);
  }
}

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

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

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

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

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

@Override
public ConfigSource apply(Config config) throws ConfigMappingException, MissingValueException {
  Config properties = config.get(PROPERTIES_KEY) // use properties config node
      .asNode()
      .orElse(Config.empty(config)); // or empty config node
  return OptionalHelper.from(config.get(TYPE_KEY)
                    .asString() // `type` is specified
                    .flatMap(type -> OptionalHelper
                        .from(builtin(type, properties)) // return built-in source
                        .or(() -> providers(type, properties))
                        .asOptional())) // or use sources - custom type to class mapping
      .or(() -> config.get(CLASS_KEY)
          .as(Class.class) // `class` is specified
          .flatMap(clazz -> custom(clazz, properties))) // return custom source
      .asOptional()
      .orElseThrow(() -> new ConfigMappingException(config.key(), "Uncompleted source configuration."));
}

相关文章