private void setProperties(XmlTemplate aTemplate, Map properties) { Iterator it = properties.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); Object value = properties.get(key); if (value instanceof String) { aTemplate.setVariable(key, (String) value); } else if (value instanceof Calendar) { aTemplate.setVariable(key, (Calendar) value); } else if (value instanceof Long) { aTemplate.setVariable(key, ((Long) value).longValue()); } else if (value instanceof Date) { aTemplate.setVariable(key, (Date) value); } else { aTemplate.setVariable(key, String.valueOf(value)); } } }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</code> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Calendar value) { setVariable(name, Util.getTimestamp(value)); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</start> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Date value) { setVariable(name, Util.getTimestamp(value)); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</code> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Date value) { setVariable(name, Util.getTimestamp(value)); }
/** * Sets value for a single XML template variable. Variable name should be specified * without leading '${' and ending '}' placeholder markers. For example, for a placeholder * <code>${start}</code>, specify <code>start</start> for the <code>name</code> parameter. * * @param name variable name * @param value value to be set in the XML template */ public void setVariable(String name, Calendar value) { setVariable(name, Util.getTimestamp(value)); }