Skip to content

Conversation

@robert-bor
Copy link
Member

When performing a conversion from an enum to the same enum, the
AnyToEnumConverter is triggered, which performs a full cycle conversion,
using the toString() method of source and the valueOf() of the target
enum.

When the source enum is the same as the target enum and the source enum
has an overridden toString() method, this fails because the value can
not be mapped to the enum.

Instead, the AnyToEnumConverter now checks whether the source is of the
same enum class as the target. If this is the case, the conversion task
is skipped and the source is returned literally.

When performing a conversion from an enum to the same enum, the
AnyToEnumConverter is triggered, which performs a full cycle conversion,
using the toString() method of source and the valueOf() of the target
enum.

When the source enum is the same as the target enum and the source enum
has an overridden toString() method, this fails because the value can
not be mapped to the enum.

Instead, the AnyToEnumConverter now checks whether the source is of the
same enum class as the target. If this is the case, the conversion task
is skipped and the source is returned literally.
@robert-bor robert-bor requested a review from jeroenvs July 17, 2021 15:06
@codecov
Copy link

codecov bot commented Jul 17, 2021

Codecov Report

Merging #136 (65a9628) into master (1e2ee76) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #136   +/-   ##
=========================================
  Coverage     93.27%   93.28%           
- Complexity      844      845    +1     
=========================================
  Files            87       87           
  Lines          1784     1786    +2     
  Branches        174      175    +1     
=========================================
+ Hits           1664     1666    +2     
  Misses           72       72           
  Partials         48       48           
Impacted Files Coverage Δ
...mapper/core/converter/impl/AnyToEnumConverter.java 75.00% <100.00%> (+5.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e2ee76...65a9628. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants