Eldelshell
Eldelshell

Reputation: 6940

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

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 logger = 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.

Upvotes: 2

Views: 289

Answers (1)

user319799
user319799

Reputation:

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

logger = SimpleLogger (SimpleLogger)

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

etc.

Upvotes: 1

Related Questions