Skip attribute conversion if value is target type while binding value

Description

I have an AttributeConverter which convert Set<String> to comma separated string.

It's works with:

And I wish it works with:

But it will throw ClassCastException:

Environment

None

Activity

Show:
周雁鸣
June 30, 2016, 5:16 AM
Vlad Mihalcea
July 25, 2016, 2:23 PM

This is not a correct behavior. If you ran all tests against your change proposal, you would find that some tests are failing because we might want to have converters like AttributeConverter<Integer, Integer>, in which case your change will no longer work.

In any query, you need to pass the actual type of the property in question. The reason why you get this issue is because you are not using the Converter as it was designed to be used.

周雁鸣
August 1, 2016, 12:15 AM

You are right, and my request is reasonable too. here is my proposal, catching ClassCastException and skip conversion, it will not break current behaviour.

Assignee

Vlad Mihalcea

Reporter

周雁鸣

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure