当前位置: 首页>>代码示例>>Java>>正文


Java ConfigResolveOptions类代码示例

本文整理汇总了Java中com.typesafe.config.ConfigResolveOptions的典型用法代码示例。如果您正苦于以下问题:Java ConfigResolveOptions类的具体用法?Java ConfigResolveOptions怎么用?Java ConfigResolveOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfigResolveOptions类属于com.typesafe.config包,在下文中一共展示了ConfigResolveOptions类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfig

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
@Override
public Config getConfig() throws IOException {
  PathMatcher pathMatcher;

  try {
    pathMatcher = FileSystems.getDefault().getPathMatcher(inputFilePattern);
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(
        "Invalid input file pattern: " + inputFilePattern);
  }

  try (Stream<Path> pathStream = Files.walk(baseDirectory)) {
    return pathStream
        .filter(p -> Files.isRegularFile(p) && pathMatcher.matches(p))
        .map(p -> ConfigFactory.parseFile(p.toFile()))
        .reduce(ConfigFactory.empty(), Config::withFallback)
        .resolve(
            ConfigResolveOptions.defaults()
                .setAllowUnresolved(true)
                .setUseSystemEnvironment(false)
        );
  }
}
 
开发者ID:okvee,项目名称:tscfg-docgen,代码行数:24,代码来源:PathMatcherConfigProvider.java

示例2: load

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
/**
 * Evaluates the {@link ConfigSource}s, {@link #bind(Class) bind}s the
 * resulting {@link Config}, then evaluates the {@link ConfigSource}s
 * again.
 *
 * <p>The second evaluation takes place to allow sources to utilize
 *   values produced by other config sources.</p>
 */
public Config load() {

    ConfigResolveOptions resolveOptions = getResolveOptions();
    HashMapBindings bindings = this.bindings;
    Config config = emptyConfig();

    for (int i = 0; i < 2; i++) {

        config = emptyConfig();

        for (ConfigSource source
                : sources.fromHighestToLowestPrecedence()) {

            config = config.withFallback(source.load(bindings));
        }

        config = config.resolve(resolveOptions);
        bindings = bindings.set(Config.class, config);
    }

    return config;
}
 
开发者ID:gtri,项目名称:typesafeconfig-extensions,代码行数:31,代码来源:ConfigFactory.java

示例3: asMap

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
/**
 * @return All properties that are currently loaded from internal and
 * external files
 */
@Override
public Map<String, Object> asMap() {
    return configuration
            .resolve(ConfigResolveOptions.defaults().setUseSystemEnvironment(true).setAllowUnresolved(true))
            .root()
            .unwrapped();
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:12,代码来源:ConfigurationImpl.java

示例4: getResolveOptions

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
private ConfigResolveOptions getResolveOptions() {

        Binding<ConfigResolveOptions> resolveOptionsBinding =
            bindings.get(ConfigResolveOptions.class);

        if (resolveOptionsBinding.isPresent()) {
            return resolveOptionsBinding.get();
        } else {
            return ConfigResolveOptions.defaults();
        }
    }
 
开发者ID:gtri,项目名称:typesafeconfig-extensions,代码行数:12,代码来源:ConfigFactory.java

示例5: resolve

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
@Override
public Config resolve(ConfigResolveOptions options) {
  return c.resolve(options);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:NestedConfig.java

示例6: resolve

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
@Override
public Config resolve(ConfigResolveOptions options) {
  return config.resolve(options);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:NestedConfig.java

示例7: resolveWith

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
@Override
public Config resolveWith(Config arg0, ConfigResolveOptions arg1) {
  return resolveWith(arg0, arg1);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:NestedConfig.java

示例8: defaultBindings

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
/**
 * Some default bindings that most config factories will need.
 *
 * <ul>
 *   <li>
 *     {@link ClassLoader} &rarr;
 *     {@link Thread#currentThread()}.{@link Thread#getContextClassLoader()
 *       getContextClassLoader()}
 *   </li>
 *   <li>
 *     {@link com.typesafe.config.ConfigParseOptions} &rarr;
 *     {@link com.typesafe.config.ConfigParseOptions#defaults()}
 *   </li>
 *   <li>
 *     {@link com.typesafe.config.ConfigResolveOptions} &rarr;
 *     {@link com.typesafe.config.ConfigParseOptions#defaults()}
 *   </li>
 *   <li>
 *     {@link com.typesafe.config.Config} &rarr;
 *     {@link com.typesafe.config.ConfigFactory#empty()
 *       ConfigFactory.empty()}
 *   </li>
 * </ul>
 */
public static Bindings defaultBindings() {

    return noHashMapBindings()
        .set(
            ClassLoader.class,
            Thread.currentThread().getContextClassLoader()
        )
        .set(
            ConfigParseOptions.class,
            ConfigParseOptions.defaults()
        )
        .set(
            ConfigResolveOptions.class,
            ConfigResolveOptions.defaults()
        )
        .set(
            Config.class,
            emptyConfig()
        );
}
 
开发者ID:gtri,项目名称:typesafeconfig-extensions,代码行数:45,代码来源:ConfigFactory.java

示例9: withResolveOptions

import com.typesafe.config.ConfigResolveOptions; //导入依赖的package包/类
/**
 * Binds a {@link ConfigResolveOptions} instance.
 *
 * <p>Equivalent to</p>
 * <pre>{@code
 * bind(ConfigResolveOptions.class).toInstance(resolveOptions)
 * }</pre>
 *
 * @see #bind(Class)
 */
public ConfigFactory
withResolveOptions(ConfigResolveOptions resolveOptions) {

    return bind(ConfigResolveOptions.class)
        .toInstance(checkNotNull(resolveOptions));
}
 
开发者ID:gtri,项目名称:typesafeconfig-extensions,代码行数:17,代码来源:ConfigFactory.java


注:本文中的com.typesafe.config.ConfigResolveOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。