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


Java Config.withValue方法代码示例

本文整理汇总了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;
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:17,代码来源:InitializerTest.java

示例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;
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:17,代码来源:GenesisLoadTest.java

示例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;
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:17,代码来源:InitializerTest.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:DremioConfig.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:27,代码来源:DremioConfig.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:DremioConfig.java

示例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;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:7,代码来源:TrainWorker.java


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