I\'d like to write a method that can accept a type param (or whatever the method can figure out the type from) and return a value of this type so I don\'t have to cast the r
The short answer is don't. As soon as instanceof gets involved, Generics are usually the wrong answer. Use overloaded methods instead:
instanceof
public String doIt(String param){ return "string"; } public Integer doIt(Integer param){ return 1; } public Object doIt(Object param){ return null; }