/** * Allows an external system to set a property in * the Velocity Runtime. * * @param key property key * @param value property value */ public void setProperty(String key, Object value) { if (overridingProperties == null) { overridingProperties = new ExtProperties(); } overridingProperties.setProperty(key, value); }
/** * Convert a Map into a configuration class. * <p> * NOTE: From Commons Collections 3.2 this method will pick up * any default parent Properties of the specified input object. * * @param props the Map object to convert * @return new ExtProperties created from props */ public static ExtProperties convertProperties(Map props) { ExtProperties c = new ExtProperties(); for (Map.Entry entry : (Set<Map.Entry>)props.entrySet()) { c.setProperty(String.valueOf(entry.getKey()), entry.getValue()); } return c; }
/** * Convert a standard properties class into a configuration class. * <p> * NOTE: From Commons Collections 3.2 this method will pick up * any default parent Properties of the specified input object. * * @param props the properties object to convert * @return new ExtProperties created from props */ public static ExtProperties convertProperties(Properties props) { ExtProperties c = new ExtProperties(); for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { String s = (String) e.nextElement(); c.setProperty(s, props.getProperty(s)); } return c; }
/** * Combines an existing Hashtable with this Hashtable. * <p> * Warning: It will overwrite previous entries without warning. * * @param props the properties to combine */ public void combine(ExtProperties props) { for (Iterator it = props.getKeys(); it.hasNext();) { String key = (String) it.next(); setProperty(key, props.get(key)); } }
loaderConfiguration.setProperty(RuntimeConstants.RESOURCE_LOADER_IDENTIFIER, loaderName);