开发者

Calling a method with a java.lang.Class in Jython

开发者 https://www.devze.com 2023-01-12 10:01 出处:网络
I\'m trying to use SimpleLog from Jython but I can\'t find any way of using its constructors because one of the arguments is always a java.lang.Class.

I'm trying to use SimpleLog from Jython but I can't find any way of using its constructors because one of the arguments is always a java.lang.Class.

logger = SimpleLogger(name) <--doesn't work lo开发者_如何学编程gger = SimpleLogger(self) <--doesn't work logger = SimpleLogger(SimpleLogger.class) <--doesn't work

The problem right now is with SimpleLog, but I bet many other libraries have this approach.

Thanks.


Just pass the type itself, it maps to the class in Java:

logger = SimpleLogger (SimpleLogger)

from com.foo import DaClass
logger = SimpleLogger (DaClass)

etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号