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


Java ConfigUtil.quoteString方法代码示例

本文整理汇总了Java中com.typesafe.config.ConfigUtil.quoteString方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigUtil.quoteString方法的具体用法?Java ConfigUtil.quoteString怎么用?Java ConfigUtil.quoteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.typesafe.config.ConfigUtil的用法示例。


在下文中一共展示了ConfigUtil.quoteString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: internalExtractURIQueryParams

import com.typesafe.config.ConfigUtil; //导入方法依赖的package包/类
private void internalExtractURIQueryParams(String paramName, String url, List expected, int maxParams) throws Exception {
  String fileName = "test-morphlines/extractURIQueryParameters";
  String overridesStr = "queryParam : " + ConfigUtil.quoteString(paramName);
  if (maxParams >= 0) {
    fileName += "WithMaxParameters";
    overridesStr += "\nmaxParameters : " + maxParams;
  }
  Config override = ConfigFactory.parseString(overridesStr);
  morphline = createMorphline(fileName, override);
  Record record = new Record();
  record.put("in", url);
  Record expectedRecord = new Record();
  expectedRecord.put("in", url);
  expectedRecord.getFields().putAll("out", expected);
  processAndVerifySuccess(record, expectedRecord);
}
 
开发者ID:cloudera,项目名称:cdk,代码行数:17,代码来源:MorphlineTest.java

示例2: setStringToConfig

import com.typesafe.config.ConfigUtil; //导入方法依赖的package包/类
/**
 * Sets the String value for current configuration's variable to config.
 *
 * @param key
 *            The name of settings section.
 * @param subKey
 *            The name of needed variable.
 * @param value
 *            The value to set.
 */
private static void setStringToConfig(String key, String subKey, String newValue,
		boolean hideValue) {
	String fullPath = MAINKEY + "." + key + "." + subKey;
	if (getString(key, subKey).equals(newValue)) {
		String messageToLog = hideValue
				? String.format("Setting secret configuration value. Key: %s.%s", key, subKey)
				: String.format("Configuration value unchanged. Key: %s.%s Value: %s", key,
						subKey, newValue);
		logger.info(messageToLog);
		return;
	}
	String processedNewValue = ConfigUtil.quoteString(newValue);
	// Lets make new Config object with just a single variable.
	// Also lets preserve the comments from the original Config.
	ConfigOrigin or = conf.getValue(fullPath).origin();
	StringBuilder toParse = new StringBuilder();
	for (String comment : or.comments()) {
		toParse.append("#").append(comment).append("\n");
	}
	toParse.append(fullPath).append("=").append(processedNewValue);
	Config newLittleConfig = ConfigFactory.parseString(toParse.toString());
	// Now we have our little Config with the single variable and old comments.
	// Let's merge it with the old Config.
	conf = newLittleConfig.withFallback(conf);
	if (!hideValue) {
		logger.info(String.format("Configuration update in RAM. Key: %s.%s Value: %s", key, subKey, newValue));
	}
	needsSave = true;
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:40,代码来源:CuteConfig.java

示例3: toJson

import com.typesafe.config.ConfigUtil; //导入方法依赖的package包/类
private String toJson(Object key) {
  String str = key == null ? "" : key.toString();
  str = ConfigUtil.quoteString(str);
  return str;
}
 
开发者ID:europeana,项目名称:search,代码行数:6,代码来源:SolrLocator.java


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