Hello!
I'm going through the fields of a class one at a time and need to handle
differently depending on whether they are arrays or scalars.
What's the right way to make the distinction? The snippet below fails to
detect arrays :(
Thanks!
-mi
import java.lang.reflect.*;
.....
for (Field field : getClass().getFields()) {
Type type = field.getGenericType();
System.err.println("Type of " + field + " is " + type + type.getClass());
if (type instanceof GenericArrayType)
System.err.println(field + " is an array!");
else
System.err.println(field + " is not an array");
}