How to get the type (class) of a groovy list

Asked

Viewed 78 times

1

I have the code below:

Set<String> list

How to know the type of this list? In case it would be java.lang.String

  • I’m not an expert on Groovy (far from being). But considering that JVM implements type Erasure, it is quite likely that it is not possible for you to get type Parameter from a generic type (unless you yourself store type information in another way).

  • 2

    Able to solve now through this link http://stackoverflow.com/questions/1942644/get-generic-type-of-java-util-list as groovy is a "turbo java, but dynamic" gave the right code

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.