Hi Thanks for this suggestion. I'll have a closer look at it soon
Cheers Lukas Am Freitag, 8. Juni 2012 schrieb digulla <[email protected]>: > Hello, > While browsing the sources, I saw the code in DefaultBindContext and I have some suggestions how to optimize it. > Create a StatementSetter interface which has these methods > set(PreparedStatement stmt, int index, Object value) > handles(Class<?> type) > and create lots of implementations (one for each type). Put the code from the if-statement into the handles() method. > Now you can define a Map<Class<?>, StatementSetter> in DefaultBindContext. Register all the defaults. When you encounter an unknown type, call the handles() methods until one returns true and put the handler into the map with the new key. > The code in bindValue0() will then become: > StatementSetter setter = lookup(type); > setter.set(stmt, nextIndex(), value); > Regards, > A. Digulla
