I'm looking through a list of methods and want to identify those that return a primitive (or a primitive wrapper class). Other than a big switch
statement is there a simple way to do this?
Method[] methods = fooObj.getClass().getMethods();
for(int i = 0; i < methods.length; i++) {
Method m = methods[i];
Class c = m.getReturnType();
if(c == void.class) {
println("does not return anything.");
}
if( ??? ) { // <--- what expression to use?
println("a primitive, or primitive wrapper, is returned.");
}
}