Enum Fields #44

Closed
anotherpit opened this Issue Mar 16, 2012 · 2 comments

2 participants

@anotherpit

Can't reopen issue #17, so have to create a new one.

org.orman.mapper.ReverseMapping is broken as its method map() causes ClassCastException when trying to cast String to Integer: fieldValue = enumConstant[(Integer) fieldValue];.

The whole enum processing should be moved to smartCasting() method and use new Integer(value.toString()) for enums.

@ahmetalpbalkan

I have no idea how fieldValue arrived there as String but your solution is better for converting to Integer. I also handled enum field being null that previously logged an error due to NullPointerException redundantly. Updated the jar in Downloads. Thanks!

@anotherpit

Neither can I figure out why I decided it was String to Integer conversion problem. Anyway, new JAR works like a charm. Thanks.

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