本文整理汇总了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);
}
}
示例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.");
}
示例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);
}
}
示例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);
}
}
示例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);
}
}