當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfigObject.keySet方法代碼示例

本文整理匯總了Java中com.typesafe.config.ConfigObject.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigObject.keySet方法的具體用法?Java ConfigObject.keySet怎麽用?Java ConfigObject.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.typesafe.config.ConfigObject的用法示例。


在下文中一共展示了ConfigObject.keySet方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BatchStep

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
public BatchStep(String name, Config config) {
  super(name, config);
  
  if ((config.hasPath(INPUT_PREFIX + REPARTITION_NUM_PARTITIONS_PROPERTY) ||
       config.hasPath(DERIVER_PREFIX + REPARTITION_NUM_PARTITIONS_PROPERTY) ||
       config.hasPath(INPUT_PREFIX + REPARTITION_COLUMNS_PROPERTY) ||
       config.hasPath(DERIVER_PREFIX + REPARTITION_COLUMNS_PROPERTY)) &&
      (config.hasPath(INPUT_PREFIX + COALESCE_NUM_PARTITIONS_PROPERTY) ||
       config.hasPath(DERIVER_PREFIX + COALESCE_NUM_PARTITIONS_PROPERTY)))
  {
    throw new RuntimeException("Step " + getName() + " can not both repartition and coalesce.");
  }

  if (config.hasPath(REPETITION_PREFIX)) {
    ConfigObject repConfig = config.getObject(REPETITION_PREFIX);
    for (String rep : repConfig.keySet()) {
      RepetitionFactory.create(this, rep, config.getConfig(REPETITION_PREFIX).getConfig(rep));
    }
  }
}
 
開發者ID:cloudera-labs,項目名稱:envelope,代碼行數:21,代碼來源:BatchStep.java

示例2: validateConfig

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
public static boolean validateConfig(Config config) {
  boolean isValid = true;

  // Does config have all required sections?
  // TODO localize required properties to individual serdes
  for (String property : REQUIRED_CONFIGS) {
    if (!config.hasPath(property)) {
      LOG.error("'{}' not specified in config", property);
      isValid = false;
    }
  }

  // Specific checks for columns
  if (config.hasPath(COLUMNS_PROPERTY)) {
    ConfigObject columnConfig = config.getConfig(COLUMNS_PROPERTY).root();
    Set<String> columns = columnConfig.keySet();
    for (String column : columns) {
      if (!config.hasPath(COLUMNS_PROPERTY + "." + column + ".col")) {
        LOG.error("'col' not specified in column {}", column);
        isValid = false;
      }
      if (!config.hasPath(COLUMNS_PROPERTY + "." + column + ".type")) {
        LOG.error("'type' not specified in column {}", column);
        isValid = false;
      }
      if (!config.hasPath(COLUMNS_PROPERTY + "." + column + ".cf")) {
        LOG.error("'cf' not specified in column {}", column);
        isValid = false;
      }
    }
  }

  return isValid;
}
 
開發者ID:cloudera-labs,項目名稱:envelope,代碼行數:35,代碼來源:HBaseUtils.java

示例3: getAllRunes

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
public Set<Rune> getAllRunes(File p) {
	Set<Rune> s = new HashSet<>();
	Config config = ConfigFactory.parseFile(p);
	logger.info("Loading runes from " + p.getName());
	ConfigObject runes = config.getObject("Runes");
	for (String a : runes.keySet()) {
		Rune r = new Rune();
		r.setName(a);
		r.setSpawnchance(0);
		s.add(r);
	}
	return s;
}
 
開發者ID:NeumimTo,項目名稱:NT-RPG,代碼行數:14,代碼來源:RWDao.java

示例4: loadAttributes

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
private void loadAttributes(com.typesafe.config.Config cfg, Map<String, Map<String, String>> attributesMap,
                            String configSet, String keyName) {
    // Get host attribute map
    for (ConfigObject h : cfg.getObjectList(configSet)) {
        String hostId = String.valueOf(h.get(keyName).unwrapped());
        Map<String, String> hostAttribute = new HashMap<>();
        attributesMap.put(hostId, hostAttribute);
        for (String key : h.keySet()) {
            hostAttribute.put(key, String.valueOf(h.get(key).unwrapped()));
        }
    }
}
 
開發者ID:yahoo,項目名稱:gondola,代碼行數:13,代碼來源:Config.java

示例5: fromConfig

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
/**
 * Get the instruments from a configuration object.
 *
 * @param config a configuration object
 * @param path the path expression
 * @return the instruments
 * @throws ConfigException if a configuration error occurs
 */
public static Instruments fromConfig(Config config, String path) {
    ConfigObject root = config.getObject(path);

    Config rootConfig = root.toConfig();

    int priceIntegerDigits = getInt(rootConfig, "price-integer-digits", 1);
    int sizeIntegerDigits  = getInt(rootConfig, "size-integer-digits",  1);

    Set<String> instruments = root.keySet();

    instruments.remove("price-integer-digits");
    instruments.remove("size-integer-digits");

    List<Instrument> values = new ArrayList<>();

    for (String instrument : instruments)
        values.add(Instrument.fromConfig(rootConfig, instrument));

    int maxPriceFractionDigits = max(values, Instrument::getPriceFractionDigits);
    int maxSizeFractionDigits  = max(values, Instrument::getSizeFractionDigits);

    for (Instrument value : values) {
        value.setPriceFormat(priceIntegerDigits, maxPriceFractionDigits);
        value.setSizeFormat(sizeIntegerDigits, maxSizeFractionDigits);
    }

    return new Instruments(values, priceIntegerDigits, maxPriceFractionDigits,
            sizeIntegerDigits, maxSizeFractionDigits);
}
 
開發者ID:paritytrading,項目名稱:parity,代碼行數:38,代碼來源:Instruments.java

示例6: groupPanels

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
private void groupPanels() {

        Config config = Lookup.getConfig();
        ConfigObject groups = config.getObject("vars.query.column.groups");
        Config groupsConfig = groups.toConfig();

        List<AbstractValuePanel> vps = new ArrayList<>(valuePanels);
        List<AbstractValuePanel> used = new ArrayList<>();

        Set<String> groupNames = groups.keySet();
        for (String name : groupNames) {
            formLayout.addHeader(name);
            List<String> columns = groupsConfig.getStringList(name);
            List<AbstractValuePanel> matchingVps = vps.stream()
                    .filter(vp -> columns.contains(vp.getValueName()))
                    .sorted((vp1, vp2) ->
                            vp1.getValueName().toUpperCase().compareTo(vp2.getValueName().toUpperCase()))
                    .collect(Collectors.toList());

            matchingVps.stream().forEach(vp ->
                        formLayout.add(new EditorFormRow<>(vp.getTitle(), vp)));

            used.addAll(matchingVps);
        }

        vps.removeAll(used);
        if (!vps.isEmpty()) {
            formLayout.addHeader("Other");
            vps.stream().forEach(vp -> formLayout.add(new EditorFormRow<>(vp.getTitle(), vp)));
        }

    }
 
開發者ID:hohonuuli,項目名稱:vars,代碼行數:33,代碼來源:AdvancedSearchWorkbench.java

示例7: getServiceParametersMap

import com.typesafe.config.ConfigObject; //導入方法依賴的package包/類
public Map<String,Object> getServiceParametersMap(String serviceName, String paramName, boolean quotedStrings)
{
	Map<String,Object> result = null;
	
	try
	{
		String rootPath = "ors.services." + serviceName + "." + paramName;
		ConfigObject configObj = _config.getObject(rootPath);
		
		result = new HashMap<String, Object>();
		
		for(String key : configObj.keySet())
		{
			Object value = null;
			ConfigValue paramValue = _config.getValue(rootPath + "." + key);

			switch(paramValue.valueType())
			{
			case NUMBER:
				value = paramValue.unwrapped();
				break;
			case OBJECT:
				Map<String,Object> map = getServiceParametersMap(serviceName, paramName + "." + key, quotedStrings);
				value = map;
				break;
			case LIST:
				value = paramValue.unwrapped();
				break;
			case STRING:
				if (quotedStrings)
					value = paramValue.render();
				else
					value = StringUtility.trim(paramValue.render(), '"');
				break;
			case BOOLEAN:
				value = paramValue.unwrapped();
			default:
				break;
			}
			
			result.put(key, value);
		}
	}
	catch(Exception ex)
	{}
	
	return result;
}
 
開發者ID:GIScience,項目名稱:openrouteservice,代碼行數:49,代碼來源:AppConfig.java


注:本文中的com.typesafe.config.ConfigObject.keySet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。