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


Java Configuration.getKeys方法代码示例

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


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

示例1: getAsciiDocOptionsAndAttributes

import org.apache.commons.configuration.Configuration; //导入方法依赖的package包/类
private Options getAsciiDocOptionsAndAttributes(ParserContext context) {
    Configuration config = context.getConfig();
    final AttributesBuilder attributes = attributes(config.getStringArray(Keys.ASCIIDOCTOR_ATTRIBUTES));
    if (config.getBoolean(Keys.ASCIIDOCTOR_ATTRIBUTES_EXPORT, false)) {
        final String prefix = config.getString(  Keys.ASCIIDOCTOR_ATTRIBUTES_EXPORT_PREFIX, "");
        for (final Iterator<String> it = config.getKeys(); it.hasNext();) {
            final String key = it.next();
            if (!key.startsWith("asciidoctor")) {
                attributes.attribute(prefix + key.replace(".", "_"), config.getProperty(key));
            }
        }
    }
    final Configuration optionsSubset = config.subset(Keys.ASCIIDOCTOR_OPTION);
    final Options options = options().attributes(attributes.get()).get();
    for (final Iterator<String> iterator = optionsSubset.getKeys(); iterator.hasNext();) {
        final String name = iterator.next();
        if (name.equals(Options.TEMPLATE_DIRS)) {
        	options.setTemplateDirs(optionsSubset.getString(name));
        } else {
        	options.setOption(name,  guessTypeByContent(optionsSubset.getString(name)));
        }
    }
    options.setBaseDir(context.getFile().getParentFile().getAbsolutePath());
    options.setSafe(UNSAFE);
    return options;
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:27,代码来源:AsciidoctorEngine.java

示例2: getPropertiesWithPrefix

import org.apache.commons.configuration.Configuration; //导入方法依赖的package包/类
public static Map<String, String> getPropertiesWithPrefix(Configuration configuration, String prefix) {
  Map<String, String> propertiesMap = new HashMap<>();

  Iterator<String> keysIterator = configuration.getKeys(prefix);
  while (keysIterator.hasNext()) {
    String key = keysIterator.next();
    propertiesMap.put(key.substring(prefix.length() + 1), String.valueOf(configuration.getProperty(key)));
  }
  return propertiesMap;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:11,代码来源:ConfigurePropertyUtils.java

示例3: createPropertiesForConfiguration

import org.apache.commons.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Creates a properties instance with the key/value pairs specified within the passed configuration object.
 *
 * @param configuration the configuration
 * @return the populated properties instance
 */
protected Properties createPropertiesForConfiguration(Configuration configuration){

	Properties properties = new Properties();

	final Iterator keys = configuration.getKeys();
	while (keys.hasNext()) {
		String key = (String) keys.next();
		List list = configuration.getList(key);
		properties.setProperty(key, (String) list.get(0));
	}

	return properties;
}
 
开发者ID:namics,项目名称:spring-configuration-support,代码行数:20,代码来源:DatabaseConfigurationPropertiesFactoryBean.java

示例4: loadProperties

import org.apache.commons.configuration.Configuration; //导入方法依赖的package包/类
public boolean loadProperties() {
	try (FileInputStream finput = new FileInputStream("resources/Bot.properties")) {
		PropertiesConfiguration config = new PropertiesConfiguration();
		config.load(finput, "UTF-8");
		config.setEncoding("UTF-8");
		botConfig.setToken(config.getString("BotToken"));
		botConfig.setAvatar(config.getString("Avatar"));
		botConfig.setBotOwnerId(config.getLong("BotOwnerId", 0));
		botConfig.setBotInviteLink(config.getString("InviteLink"));
		botConfig.setMaxSongLength(config.getInt("MaxSongLength", 15));
		botConfig.setCompanionBot(config.getBoolean("MusicCompanion", false));
		botConfig.setDefaultSSLPort(config.getInt("DefaultSSLPort", 8443));
		botConfig.setDefaultInsecurePort(config.getInt("DefaultInsecurePort", 8080));

		Configuration subset = config.subset("apikey");
		Iterator<String> iter = subset.getKeys();
		while(iter.hasNext()) {
			String key = iter.next();
			String val = subset.getString(key);
			if(val.length() > 0) {
				this.apiKeys.put(key, val);
				logger.info("Added API key for: {}", key);
			}
		}
		StatusChangeJob.setStatuses(config.getStringArray("StatusRotation"));
		return true;
	} catch (Exception e) {
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:paul-io,项目名称:momo-2,代码行数:32,代码来源:Bot.java

示例5: MaarittelyKonfiguraatio

import org.apache.commons.configuration.Configuration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private MaarittelyKonfiguraatio() throws ConfigurationException {
    maarittelyt = new HashMap<String, MaarittelyLuokka>();

    try {
        Configuration config = new PropertiesConfiguration("cda_template.properties");

        Iterator<String> templateIds = (Iterator<String>) config.getKeys();
        while (templateIds.hasNext()) {
            kasitteleTyyppi(config, templateIds.next());
        }
    }
    catch (ConfigurationException e) {
        throw e;
    }
}
 
开发者ID:TheFinnishSocialInsuranceInstitution,项目名称:KantaCDA-API,代码行数:17,代码来源:MaarittelyKonfiguraatio.java


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