Java Code Examples for org.apache.velocity.util.ExtProperties#getKeys()
The following examples show how to use
org.apache.velocity.util.ExtProperties#getKeys() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertiesFactoryConfiguration.java From velocity-tools with Apache License 2.0 | 6 votes |
protected void readData(ExtProperties 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; } Data data = new Data(); data.setKey(key); data.setValue(dataset.getString(key)); // get/set the type/converter properties ExtProperties props = dataset.subset(key); setProperties(props, data); addData(data); } } }
Example 2
Source File: PropertiesFactoryConfiguration.java From velocity-tools with Apache License 2.0 | 5 votes |
protected void readProperties(ExtProperties configProps, Configuration config) { ExtProperties properties = configProps.subset("property"); if (properties != null) { for (Iterator i = properties.getKeys(); i.hasNext(); ) { String name = (String)i.next(); String value = properties.getString(name); ExtProperties propProps = properties.subset(name); if (propProps.size() == 1) { // then set this as a 'simple' property config.setProperty(name, value); } else { // add it as a convertable property Property property = new Property(); property.setName(name); property.setValue(value); // set the type/converter properties setProperties(propProps, property); } } } }
Example 3
Source File: PropertiesFactoryConfiguration.java From velocity-tools with Apache License 2.0 | 5 votes |
protected void readTools(ExtProperties tools, ToolboxConfiguration toolbox) { for (Iterator i = tools.getKeys(); i.hasNext(); ) { String key = (String)i.next(); // if it contains a period, it can't be a context key; // it must be a tool property. ignore it for now. if (key.indexOf('.') >= 0) { continue; } String classname = tools.getString(key); ToolConfiguration tool = new ToolConfiguration(); tool.setClassname(classname); tool.setKey(key); toolbox.addTool(tool); // get tool properties prefixed by 'property' ExtProperties toolProps = tools.subset(key); readProperties(toolProps, tool); // ok, get tool properties that aren't prefixed by 'property' for (Iterator j = toolProps.getKeys(); j.hasNext(); ) { String name = (String)j.next(); if (!name.equals(tool.getKey())) { tool.setProperty(name, toolProps.getString(name)); } } // get special props explicitly String restrictTo = toolProps.getString("restrictTo"); tool.setRestrictTo(restrictTo); } }
Example 4
Source File: RuntimeInstance.java From velocity-engine with Apache License 2.0 | 5 votes |
private void initializeScopeSettings() { ExtProperties scopes = configuration.subset(CONTEXT_SCOPE_CONTROL); if (scopes != null) { Iterator<String> scopeIterator = scopes.getKeys(); while (scopeIterator.hasNext()) { String scope = scopeIterator.next(); boolean enabled = scopes.getBoolean(scope); if (enabled) enabledScopeControls.add(scope); } } }