本文整理匯總了Java中com.typesafe.config.Config.withValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.withValue方法的具體用法?Java Config.withValue怎麽用?Java Config.withValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.withValue方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: withConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
private SystemProperties withConfig(int databaseVersion, Initializer.DatabaseVersionHandler.Behavior behavior) {
Config config = ConfigFactory.empty()
// reset is true for tests
.withValue("database.reset", ConfigValueFactory.fromAnyRef(false));
if (behavior != null) {
config = config.withValue("database.incompatibleDatabaseBehavior",
ConfigValueFactory.fromAnyRef(behavior.toString().toLowerCase()));
}
SPO systemProperties = new SPO(config);
systemProperties.setDataBaseDir(databaseDir);
systemProperties.setDatabaseVersion(databaseVersion);
return systemProperties;
}
示例2: loadGenesis
import com.typesafe.config.Config; //導入方法依賴的package包/類
private SystemProperties loadGenesis(String genesisFile, String genesisResource) {
Config config = ConfigFactory.empty();
if (genesisResource != null) {
config = config.withValue("genesis",
ConfigValueFactory.fromAnyRef(genesisResource));
}
if (genesisFile != null) {
config = config.withValue("genesisFile",
ConfigValueFactory.fromAnyRef(genesisFile));
}
SystemProperties properties = new SystemProperties(config);
properties.getGenesis();
return properties;
}
示例3: withConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
private SystemProperties withConfig(int databaseVersion, Behavior behavior) {
Config config = ConfigFactory.empty()
// reset is true for tests
.withValue("database.reset", ConfigValueFactory.fromAnyRef(false));
if (behavior != null) {
config = config.withValue("database.incompatibleDatabaseBehavior",
ConfigValueFactory.fromAnyRef(behavior.toString().toLowerCase()));
}
SPO systemProperties = new SPO(config);
systemProperties.setDataBaseDir(databaseDir);
systemProperties.setDatabaseVersion(databaseVersion);
return systemProperties;
}
示例4: applyLegacySystemProperties
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* Remove this once all scripts stop referencing these old properties.
*/
@Deprecated
private static Config applyLegacySystemProperties(Config config){
// legacy stuff for now.
config = setSystemProperty(config, "dremd.write", LOCAL_WRITE_PATH_STRING);
config = setSystemProperty(config, "dremio_autoPort", DEBUG_AUTOPORT_BOOL);
config = setSystemProperty(config, "dremd.master", MASTER_NODE_STRING);
config = setSystemProperty(config, "dremd.masterPort", MASTER_PORT_INT);
config = setSystemProperty(config, "dac_prepopulate", DEBUG_PREPOPULATE_BOOL);
config = setSystemProperty(config, "dremio_allowTestApis", DEBUG_ALLOW_TEST_APIS_BOOL);
config = setSystemProperty(config, "dremd.localPort", SERVER_PORT_INT);
config = setSystemProperty(config, "dremd.httpPort", WEB_PORT_INT);
if("LOCAL".equalsIgnoreCase(System.getProperty("dremd.mode"))){
config = config.withValue(DEBUG_SINGLE_NODE_BOOL, ConfigValueFactory.fromAnyRef(true));
logger.info("Applying provided leagcy system property to config: -Ddremd.mode=LOCAL");
}
return config;
}
示例5: applySystemProperties
import com.typesafe.config.Config; //導入方法依賴的package包/類
private static Config applySystemProperties(Config config, Config reference){
for (Entry<String, ConfigValue> entry : reference.entrySet()) {
String property = System.getProperty(entry.getKey());
if (property != null && !property.isEmpty()) {
// hack to deal with array of strings
if (property.startsWith("[") && property.endsWith("]")) {
property = property.substring(1, property.length()-1);
if (property.trim().isEmpty()) {
continue;
}
String[] strings = property.split(",");
if (strings != null && strings.length > 0) {
List<String> listStrings = new ArrayList<>();
for (String str : strings) {
listStrings.add(str.trim());
}
config = config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(listStrings));
}
} else {
config = config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(property));
}
logger.info("Applying provided system property to config: -D{}={}", entry.getKey(), property);
}
}
return config;
}
示例6: setSystemProperty
import com.typesafe.config.Config; //導入方法依賴的package包/類
private static Config setSystemProperty(Config config, String sysProp, String configProp){
String systemProperty = System.getProperty(sysProp);
if(systemProperty != null) {
config = config.withValue(configProp, ConfigValueFactory.fromAnyRef(systemProperty));
logger.info("Applying provided leagcy system property to config: -D{}={}", configProp, systemProperty);
}
return config;
}
示例7: updateConfigWithCustom
import com.typesafe.config.Config; //導入方法依賴的package包/類
private Config updateConfigWithCustom(Config config) {
for (Map.Entry<String, Object> entry : customParamsMap.entrySet()) {
config = config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(entry.getValue()));
}
return config;
}