/** * Deserialize a string representation to an object for a given type * * @param pType type to convert to * @param pValue the value to convert from * @return the converted value */ public Object convertFromString(String pType, String pValue) { String value = convertSpecialStringTags(pValue); if (value == null) { return null; } if (pType.startsWith("[") && pType.length() >= 2) { return convertToArray(pType, value); } Parser parser = PARSER_MAP.get(pType); if (parser != null) { return parser.extract(value); } Object cValue = convertByConstructor(pType, pValue); if (cValue != null) { return cValue; } throw new IllegalArgumentException( "Cannot convert string " + value + " to type " + pType + " because no converter could be found"); }
/** * Deserialize a string representation to an object for a given type * * @param pType type to convert to * @param pValue the value to convert from * @return the converted value */ public Object convertFromString(String pType, String pValue) { String value = convertSpecialStringTags(pValue); if (value == null) { return null; } if (pType.startsWith("[") && pType.length() >= 2) { return convertToArray(pType, value); } Parser parser = PARSER_MAP.get(pType); if (parser != null) { return parser.extract(value); } Object cValue = convertByConstructor(pType, pValue); if (cValue != null) { return cValue; } throw new IllegalArgumentException( "Cannot convert string " + value + " to type " + pType + " because no converter could be found"); }
/** * Deserialize a string representation to an object for a given type * * @param pType type to convert to * @param pValue the value to convert from * @return the converted value */ public Object convertFromString(String pType, String pValue) { String value = convertSpecialStringTags(pValue); if (value == null) { return null; } if (pType.startsWith("[") && pType.length() >= 2) { return convertToArray(pType, value); } Parser parser = PARSER_MAP.get(pType); if (parser != null) { return parser.extract(value); } Object cValue = convertByConstructor(pType, pValue); if (cValue != null) { return cValue; } throw new IllegalArgumentException( "Cannot convert string " + value + " to type " + pType + " because no converter could be found"); }