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


Java XMLConfiguration.getList方法代码示例

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


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

示例1: main

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public static void main(String[] args) throws ConfigurationException {
    XMLConfiguration config = new XMLConfiguration("CourseManagementSystem.xml");
    List techIdList = config.getList("Teachers.Teacher.id");
    for (Object id : techIdList) {
        System.out.println(id);
    }
}
 
开发者ID:vagabond1-1983,项目名称:javaDemo,代码行数:8,代码来源:readMultiNode.java

示例2: initTopics

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
protected void initTopics(XMLConfiguration config) {
	int nbrTopics = 0;
	Object temp = config.getList("Topics.Topic[@name]");
	if (temp instanceof Collection) {
		nbrTopics = ((Collection)temp).size();
	}
	
	Topic topic;
	String readOnlyStr;
	for (int i = 0; i < nbrTopics; i++) {
		topic = new Topic();
		gatherTopicAttributes(config, topic, i);
		gatherAliasAttributes(config, topic);
		gatherKeyFields(config, topic);
		
		validateTopic(topic);			
		topicMap.put(topic.getTopicName(), topic);
		pluralNameMap.put(topic.getPluralName(), topic);
	}
	
	Validate.isTrue(topicMap.size() > 0, "No Topics configured.");	
}
 
开发者ID:Derek-Ashmore,项目名称:moneta,代码行数:23,代码来源:MonetaConfiguration.java

示例3: gatherAliasAttributes

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
protected void gatherAliasAttributes(XMLConfiguration config, Topic topic) {
	int nbrAliases = 0;
	Object temp = config.getList("Topics.Topic.Alias[@name]");
	if (temp instanceof Collection) {
		nbrAliases = ((Collection)temp).size();
	}
	
	String name, column;
	for (int i = 0; i < nbrAliases; i++) {
		name=config.getString("Topics.Topic.Alias(" + i + ")[@name]");
		column=config.getString("Topics.Topic.Alias(" + i + ")[@column]");
		if (StringUtils.isEmpty(name) || StringUtils.isEmpty(column)) {
			throw new MonetaException("Topic Alias fields must have both name and column specified")
				.addContextValue("topic", topic.getTopicName())
				.addContextValue("name", name)
				.addContextValue("column", column);
		}
		topic.getAliasMap().put(column, name);
	}
}
 
开发者ID:Derek-Ashmore,项目名称:moneta,代码行数:21,代码来源:MonetaConfiguration.java

示例4: gatherKeyFields

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
protected void gatherKeyFields(XMLConfiguration config, Topic topic) {
	int nbrKeyFields = 0;
	Object temp = config.getList("Topics.Topic.PrimaryKey.Field[@name]");
	if (temp instanceof Collection) {
		nbrKeyFields = ((Collection)temp).size();
	}
	
	String name, typeStr;
	TopicKeyField.DataType dataType;
	TopicKeyField keyField;
	for (int i = 0; i < nbrKeyFields; i++) {
		name=config.getString("Topics.Topic.PrimaryKey.Field(" + i + ")[@name]");
		typeStr=config.getString("Topics.Topic.PrimaryKey.Field(" + i + ")[@type]");
		if (StringUtils.isEmpty(name) || StringUtils.isEmpty(typeStr)) {
			throw new MonetaException("Topic Primary Key Fields fields must have both name and type specified")
				.addContextValue("topic", topic.getTopicName())
				.addContextValue("name", name)
				.addContextValue("type", typeStr);
		}
		try {dataType = TopicKeyField.DataType.valueOf(typeStr.toUpperCase());}
		catch (Exception e) {
			throw new MonetaException("Datatype not supported", e)
				.addContextValue("topic", topic.getTopicName())
				.addContextValue("key field", name)
				.addContextValue("dataType", typeStr);
		}
		
		keyField = new TopicKeyField();
		topic.getKeyFieldList().add(keyField);
		keyField.setColumnName(name);
		keyField.setDataType(dataType);
	}
}
 
开发者ID:Derek-Ashmore,项目名称:moneta,代码行数:34,代码来源:MonetaConfiguration.java

示例5: main

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public static void main( String[] args ) throws ConfigurationException {
    XMLConfiguration xml = new XMLConfiguration( "WreSalesSystemInfo.xml" );
    List< Object > userIDList = xml.getList( "Users.User.id" );

    for (int i = 1 ; i<=userIDList.size() ; i++ ){
        userIDList.get(i-1);
    }







}
 
开发者ID:vagabond1-1983,项目名称:javaDemo,代码行数:16,代码来源:Test.java


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