In java, my code looks like:
new Injector(ClassToInjectOn.class, whatever)
so, the Injector class wants some Class<> argument.
Works fine when doing things in Java.
But now I want to configure an injector object using jython.
I tried:
Injector(ClassToInjectOn.class, whatever)
results in:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: instance attr: class
I tried auto-completion; and found that I could use ClassToInjectOn.__class__ ... but then the Class object that is passed into the injector will be java.lang.Class (but should be ClassToInjectOn.class).
Unfortunately searching for python and ".class" doesn't really provide useful answers.
In python ClassToInjectOn is the class object. This is why ClassToInjectOn.__class__ gives you java.lang.Class, because that's what the class of a class object. So you need only write:
Injector(ClassToInjectOn, whatever)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With