-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Labels
Description
/**
* Check if the specified converter can convert to the specified object type
*/
private boolean checkConverterByTargetType(ValueConverter<? extends Value, ?> converter, Class<?> targetClass) {
try {
ValueConverter<? extends Value, ?> exactMatch = valueConvertersByTarget.get(targetClass.getTypeName());
return exactMatch == converter ||
getInterfaceParameterClass(converter, converter.getClass(), 1).isAssignableFrom(targetClass);
} catch (InterfaceParameterClassNotFoundException | InterfaceParameterTypeNotFoundException e) {
return false;
}
}
It's too slow. We must call this once when we register converter and cache that result in map for example
private final Map<ValueConverter<? extends Value, ?>, String> targetClassesByValueConverters;