calrissian / mango

Common utilities for rapid application development
Apache License 2.0
17 stars 7 forks source link

TypeEncoders should have support for native scala types #150

Closed cjnolet closed 9 years ago

cjnolet commented 9 years ago

Unforuntately, once one begins manipulating types in Scala, those types will no longer be supported as java's types get implicitly converted to the native scala types. I think Mango should provide a mango-scala module which provides encoders that wrap the native java encoders. Jackson and many other libraries follow a similar concept of providing a specialized artifact that encapsulates the core library Scala wrappers around Java.

eawagner commented 9 years ago

This is an interesting concept, and I think it would be good to branch out support for other JVM languages, especially Scala.

I wouldn't mind if you decided to start implementing this. One concern with typeencoders is that we make sure the aliases make sense. For example, Scala's Int should probably be mapped to "integer" similar to Java's int. It is important however that if this happens that the decoding works for both the Java and Scala versions correctly, or they would not be interopable.

cjnolet commented 9 years ago

I wasn't thinking of having encoders which directly encode the Scala types but rather, a nice set of implicit conversions that can wrap the scala types and go back and forth from the scala to java automatically. See JavaConverters in the Scala libs.

cjnolet commented 9 years ago

It does look like the scala types will implicitly convert themselves into their native java counterparts. I'm closing this ticket for now.