def f[T:Manifest](t:T) =getSerializer(manifest[T].erasure)
--
Best Regards,
Volodymyr Kyrychenko
Does anything in here help you?
On 4 Mar 2011 21:10, "Konstantine Kougios" <kostas....@googlemail.com> wrote:
>
> looks useful, when is it going to be released?
>
Soon... But in a very fledgling form.
The code is all under the apache license though, so do feel free to copy & paste.
> In the meantime I tried to recreate this functionality and after a couple of puzzling errors, I think I managed it:
>
> private val IntClass=classOf[Int]
> private val DoubleClass=classOf[Double]
> private val BooleanClass=classOf[Boolean]
>
>
> private def scalaToJ(c:Class[_]) = c match {
> case IntClass => classOf[java.lang.Integer]
> case DoubleClass => classOf[java.lang.Double]
> case BooleanClass => classOf[java.lang.Boolean]
> case x => x
> }
>
>
> The puzzling errors were when my code was
>
> private val intClass=classOf[Int]
> private val doubleClass=classOf[Double]
> private val booleanClass=classOf[Boolean]
>
>
> private def scalaToJ(c:Class[_]) = c match {
> case intClass => classOf[java.lang.Integer]
> case doubleClass => classOf[java.lang.Double]
> case booleanClass => classOf[java.lang.Boolean]
> case x => x
> }
>
> I was getting an error "unreachable code: case doubleClass => classOf[java.lang.Double]"
>
> Weird! Does scala treats vals with uppercase letter differently?
>
It does for pattern matching, though you can override that behavior by wrapping the name in `backticks`
I was getting an error "unreachable code: case doubleClass => classOf[java.lang.Double]"
Weird! Does scala treats vals with uppercase letter differently?