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


Java ConfigFactory.empty方法代码示例

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

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

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

示例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);
}
 
开发者ID:conf4j,项目名称:conf4j,代码行数:16,代码来源:ClasspathConfigurationSource.java

示例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);
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:14,代码来源:PackageMetadataReader.java

示例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());
}
 
开发者ID:DevOpsStudio,项目名称:Re-Collector,代码行数:7,代码来源:CollectorHostNameConfigurationTest.java

示例7: SystemProperties

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public SystemProperties() {
    this(ConfigFactory.empty());
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:4,代码来源:SystemProperties.java

示例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());
}
 
开发者ID:Nordstrom,项目名称:xrpc,代码行数:8,代码来源:XConfig.java


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