本文整理汇总了Java中com.typesafe.config.ConfigFactory.empty方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory.empty方法的具体用法?Java ConfigFactory.empty怎么用?Java ConfigFactory.empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.typesafe.config.ConfigFactory
的用法示例。
在下文中一共展示了ConfigFactory.empty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildConfigIfAbsent
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config buildConfigIfAbsent(Config currentConfig) {
if (currentConfig != null) return currentConfig;
File configFile = new File(filePath);
if (configFile.exists()) {
return ConfigFactory.parseFile(configFile);
}
logger.debug("Missing configuration file at path: {}, ignore flag set to: {}", filePath, ignoreMissingFile);
if (ignoreMissingFile) {
return ConfigFactory.empty();
}
throw new IllegalStateException("Missing required configuration file at path: " + filePath);
}
示例2: buildConfigIfAbsent
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config buildConfigIfAbsent(Config currentConfig) {
if (currentConfig != null) return currentConfig;
Optional<String> configurationFile = kvClient.getValueAsString(configurationFilePath).toJavaUtil();
if (configurationFile.isPresent()) {
return ConfigFactory.parseString(configurationFile.get());
}
logger.debug("Missing configuration file at path: {}, ignore flag set to: {}", configurationFilePath, ignoreMissingResource);
if (ignoreMissingResource) {
return ConfigFactory.empty();
}
throw new IllegalStateException("Missing required configuration resource at path: " + configurationFilePath);
}
示例3: loadGenesis
import com.typesafe.config.ConfigFactory; //导入方法依赖的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;
}
示例4: buildConfigIfAbsent
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config buildConfigIfAbsent(Config currentConfig) {
if (currentConfig != null) return currentConfig;
if (getClass().getClassLoader().getResource(resourcePath) != null) {
return ConfigFactory.parseResources(resourcePath);
}
logger.debug("Missing configuration resource at path: {}, ignore flag set to: {}", resourcePath, ignoreMissingResource);
if (ignoreMissingResource) {
return ConfigFactory.empty();
}
throw new IllegalStateException("Missing required configuration resource at path: " + resourcePath);
}
示例5: getConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config getConfig(String configContent) {
if (configContent == null) {
return ConfigFactory.empty();
}
Properties props = new Properties();
try {
props.load(new StringReader(configContent));
return ConfigFactory.parseProperties(props);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例6: getHostNameReturnsNullIfHostNameNotOverridden
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Test
public void getHostNameReturnsNullIfHostNameNotOverridden() {
final Config config = ConfigFactory.empty();
final CollectorHostNameConfiguration hostNameConfiguration = new CollectorHostNameConfiguration(config);
assertNull(hostNameConfiguration.getHostName());
}
示例7: SystemProperties
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public SystemProperties() {
this(ConfigFactory.empty());
}
示例8: XConfig
import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
/**
* Construct a config object using the default configuration values <a
* href="https://github.com/Nordstrom/xrpc/blob/master/src/main/resources/com/nordstrom/xrpc/xrpc.conf">here</a>.
*/
public XConfig() {
this(ConfigFactory.empty());
}