All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deephacks.tools4j.config.internal.core.runtime.typesafe.ConfigResolveOptions Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
/**
 *   Copyright (C) 2011-2012 Typesafe Inc. 
 */
package org.deephacks.tools4j.config.internal.core.runtime.typesafe;

/**
 * A set of options related to resolving substitutions. Substitutions use the
 * ${foo.bar} syntax and are documented in the HOCON
 * spec.
 * 

* This object is immutable, so the "setters" return a new object. *

* Here is an example of creating a custom {@code ConfigResolveOptions}: * *

 *     ConfigResolveOptions options = ConfigResolveOptions.defaults()
 *         .setUseSystemEnvironment(false)
 * 
*

* In addition to {@link ConfigResolveOptions#defaults}, there's a prebuilt * {@link ConfigResolveOptions#noSystem} which avoids looking at any system * environment variables or other external system information. (Right now, * environment variables are the only example.) */ public final class ConfigResolveOptions { private final boolean useSystemEnvironment; private ConfigResolveOptions(boolean useSystemEnvironment) { this.useSystemEnvironment = useSystemEnvironment; } /** * Returns the default resolve options. * * @return the default resolve options */ public static ConfigResolveOptions defaults() { return new ConfigResolveOptions(true); } /** * Returns resolve options that disable any reference to "system" data * (currently, this means environment variables). * * @return the resolve options with env variables disabled */ public static ConfigResolveOptions noSystem() { return defaults().setUseSystemEnvironment(false); } /** * Returns options with use of environment variables set to the given value. * * @param value * true to resolve substitutions falling back to environment * variables. * @return options with requested setting for use of environment variables */ @SuppressWarnings("static-method") public ConfigResolveOptions setUseSystemEnvironment(boolean value) { return new ConfigResolveOptions(value); } /** * Returns whether the options enable use of system environment variables. * This method is mostly used by the typesafe lib internally, not by * applications. * * @return true if environment variables should be used */ public boolean getUseSystemEnvironment() { return useSystemEnvironment; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy