Reputation: 12024
I has a class, let it be Foo
. I also have a Foo
companion object, like
object Foo {}
class Foo {}
In one file. At some other place of code, I need to retrieve Class object of my Foo
class. However, when I do
import my.package.Foo
Foo.getClass()
returns Class object of companion object (Foo$
) rather then class one.
How can I retrieve the proper, class Class object?
Upvotes: 2
Views: 382