in datasource-client/src/main/java/org/apache/seatunnel/datasource/configuration/util/ConfigUtil.java [105:125]
public static <T> T convertValue(Object rawValue, TypeReference<T> typeReference) {
rawValue = flatteningMapWithObject(rawValue);
if (typeReference.getType() instanceof Class) {
// simple type
Class<T> clazz = (Class<T>) typeReference.getType();
if (clazz.equals(rawValue.getClass())) {
return (T) rawValue;
}
try {
return convertValue(rawValue, clazz);
} catch (IllegalArgumentException e) {
// Continue with Jackson parsing
}
}
try {
// complex type && untreated type
return JACKSON_MAPPER.readValue(convertToJsonString(rawValue), typeReference);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException(String.format("Json parsing exception, value '%s', and expected type '%s'", rawValue, typeReference.getType().getTypeName()), e);
}
}