Since after your update your question does not appear to be an exact duplicate:
You would need to call getClass()
on an instance of MyClass
. Better have a dummy static final instance somewhere:
public static final MyClass INSTANCE = new MyClass();
...
return (Class>) instance.getClass();