Java 类com.typesafe.config.ConfigResolveOptions 实例源码

项目:tscfg-docgen    文件:PathMatcherConfigProvider.java   
@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)
        );
  }
}
项目:typesafeconfig-extensions    文件:ConfigFactory.java   
/**
 * 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;
}
项目:wisdom    文件:ConfigurationImpl.java   
/**
 * @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();
}
项目:typesafeconfig-extensions    文件:ConfigFactory.java   
private ConfigResolveOptions getResolveOptions() {

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

        if (resolveOptionsBinding.isPresent()) {
            return resolveOptionsBinding.get();
        } else {
            return ConfigResolveOptions.defaults();
        }
    }
项目:QDrill    文件:NestedConfig.java   
@Override
public Config resolve(ConfigResolveOptions options) {
  return c.resolve(options);
}
项目:dremio-oss    文件:NestedConfig.java   
@Override
public Config resolve(ConfigResolveOptions options) {
  return config.resolve(options);
}
项目:dremio-oss    文件:NestedConfig.java   
@Override
public Config resolveWith(Config arg0, ConfigResolveOptions arg1) {
  return resolveWith(arg0, arg1);
}
项目:drill    文件:NestedConfig.java   
@Override
public Config resolve(ConfigResolveOptions options) {
  return c.resolve(options);
}
项目:typesafeconfig-extensions    文件:ConfigFactory.java   
/**
 * 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()
        );
}
项目:typesafeconfig-extensions    文件:ConfigFactory.java   
/**
 * 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));
}