private Object convertValue(String value, String type) { if (type == null) { // If no type is set we simply return the string value return value; } try { XMLConfigConstants.DATA_TYPES dataType = XMLConfigConstants.DATA_TYPES.valueOf(type); switch (dataType) { case BOOLEAN: return JavaUtils.isTrueExplicitly(value); case DOUBLE: return Double.parseDouble(value); case FLOAT: return Float.parseFloat(value); case INTEGER: return Integer.parseInt(value); case LONG: return Long.parseLong(value); case OM: return SynapseConfigUtils.stringToOM(value); case SHORT: return Short.parseShort(value); default: return value; } } catch (IllegalArgumentException e) { String msg = "Unknown type : " + type + " for the property mediator or the " + "property value cannot be converted into the specified type."; log.error(msg, e); throw new SynapseException(msg, e); } }
private static OMElement createOMElement(String xml) { return SynapseConfigUtils.stringToOM(xml); }