本文整理汇总了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;
}