Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for Collections of Primitives #18

Closed
tabdulradi opened this issue Jul 20, 2016 · 0 comments
Closed

Better support for Collections of Primitives #18

tabdulradi opened this issue Jul 20, 2016 · 0 comments
Labels

Comments

@tabdulradi
Copy link
Member

tabdulradi commented Jul 20, 2016

Due to limitation of Java generics, there is no Codec[int], only Codec[java.lang.Integer].
But also Datastax's driver won't let you define one from Scala (raises exception at Constructor).

Since, Scala compiler won't pick an implicit of M[java.lang.Integer] as M[Int]. This affected Troy implicit Codecs feature. As a solution, a hack was introduced for List and Set, to have a wrapper TroyCodec, that maps on every item on the collection to convert it from the Java Wrapper to the Scala Primitive.

But for Map, and Tuples, this hack would require order of magnitude more boilerplate. So currently they only support Wrapper classes, like Map[Integer, String]

See #8 and https://github.com/tabdulradi/troy/pull/17/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant