[java] How to pass a type as a method parameter in Java