The configuration type mapping should also search for implemented interfaces
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Querydsl |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Previously, there was a request for configuration to search for a type registered for superclasses, so, for example, having a Type for Calendar would also work with GregorianCalendar.
However, now I've faced a new one: This should also be extended to interfaces.
The concrete example was the BlobType (registered by default), which returns java.sql.Blob as java type.
However, each JDBC driver has it's own Blob implementation (for example, com.mysql.
I've attached a patch for this. Feel free to reject / change at will. I've done the following:
* As it could involve looking up on superclasses and all implemented interfaces (both by the class itself and any of it's superclasses), it could be a long lookup. Also, as those lookups could happen several times per query, I've created another map that maps a class to the effectively resolved type, so, future invocations would just lookup on that map.
* Added a method to resolve all implemented interfaces of a class and it's subclasses. This is not the best place for such a method (maybe on some utility class). There is an implementation of this in commons lang, on the ClassUtils.
* Changed the type finding itself to a separate method, findType, and made getType handle the lookup on the resolvedTypesBy
Changed in querydsl: | |
importance: | Undecided → Medium |
Thanks for the bug report and patch. Fixed in SVN trunk.