getting the map's value object's class name

groovy, reflection

Solution

This should work:

paramMap.each { key, value ->
    println( value.getClass().name )
}

Problem

I have a param Map which can contain strings as well as custom object types as value. How can I get the class name of the Maps value entry. ``` Right now if I do paramMap.each { println(it.value.class.name) } ``` It gives me all entries as `java.util.LinkedHashMap$Entry` How can I get the actual `type` of the value stored in the map like String, Configuration, SecurityConfig... etc. Thanks in advance

Original source