The K and V generic qualifiers will be erased at compile time; they're not
available at runtime. Given an instance of K or V (which will, of course, be
provided to your mapper), though, you can easily-enough get its class:
e.g.:
class MyMapper extends Mapper<K1, V1, K2, V2> {
public void map (K1 k, V1 v, Context c) {
Class<K1> keyClass = k.getClass();
}
}
- Aaron
On Fri, Jan 8, 2010 at 10:19 AM, Bassam Tabbara <[email protected]> wrote:
> Given an InputFormat<K,V> what is the easiest way of retrieving the class
> name of K and V? Is reflection the only way?
>
>
>
> Thanks!
>
> Bassam
>
>
>