Skip to content

Remove getInterfaceParameterClass for checkConverterByTargetType #212

@ArtDu

Description

@ArtDu
/**
* 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;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions