Example usage for org.apache.commons.collections ExtendedProperties getKeys

List of usage examples for org.apache.commons.collections ExtendedProperties getKeys

Introduction

In this page you can find the example usage for org.apache.commons.collections ExtendedProperties getKeys.

Prototype

public Iterator getKeys() 

Source Link

Document

Get the list of the keys contained in the configuration repository.

Usage

From source file:org.apache.velocity.tools.config.PropertiesFactoryConfiguration.java

protected void readData(ExtendedProperties dataset) {
    if (dataset != null) {
        for (Iterator i = dataset.getKeys(); i.hasNext();) {
            String key = (String) i.next();
            // if it contains a period, it can't be a context key; 
            // it must be a data property. ignore it for now.
            if (key.indexOf('.') >= 0) {
                continue;
            }//from   w  w  w  .  jav a2  s . c o m

            Data data = new Data();
            data.setKey(key);
            data.setValue(dataset.getString(key));

            // get/set the type/converter properties
            ExtendedProperties props = dataset.subset(key);
            setProperties(props, data);

            addData(data);
        }
    }
}

From source file:org.objectstyle.cayenne.conf.ConnectionProperties.java

/**
 * Returns a list of connection names configured
 * in the properties object.//from   ww  w . j av a2s  .  c  o m
 */
protected List extractNames(ExtendedProperties props) {
    Iterator it = props.getKeys();
    List list = new ArrayList();

    while (it.hasNext()) {
        String key = (String) it.next();

        int dotInd = key.indexOf('.');
        if (dotInd <= 0 || dotInd >= key.length()) {
            continue;
        }

        String name = key.substring(0, dotInd);
        if (!list.contains(name)) {
            list.add(name);
        }
    }

    return list;
}