I\'m trying to make a method that takes an argument of Country.class
, User.class
etc, and returns argument.count()
.
All the po
In reply to your comment to ZZ Coder; a static method in Java is called in the namespace context of a class, like Model.count()
for a static method count()
in the class Model
, but the method does not become part of Model.class
, Model.class
is an instance of Class
describing the class Model
. (I can see where the confusion originates, it would be logical to have a specialised Model.class
that includes the static methods, but Java isn't desinged that way.)
Your way out is to use reflection to call the static count()
for the class that you pass to your code.