當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。