|
|
|
|
|
by thejake
5916 days ago
|
|
The case that I've bumped up against several times is when trying to get the class of the generic object. Something like: T obj;
obj = getObjFromSomewhere();
log(T.class);
This type of operation is most useful if writing framework type of some sort. I've come across it when trying to write a generic JPA base DAO type of class. |
|
http://www.scala-blogs.org/2008/10/manifests-reified-types.h...
It's improved a bit in 2.8 - in porting some code I discovered a nice little hack that lets you declare your variance like this:
[A <: SomeBaseClass <: Manifest]
Which tells the compiler in an oh so gentle manner to reify for you.