[Py4j-users] How to access "class"
Status: Beta
Brought to you by:
barthe
From: Peter A <pet...@gm...> - 2015-07-16 00:18:40
|
Hi, I need to access the static member "class" in a Java object. For example in Java the code would look something like: if( object.getClass() == Object.class ) { // do something } Now when I try that in py4j I run into issues that "class" is a protected keyword. So the following causes it to crash: gateway.jvm.Object.class On the other hand gateway.jvm.Object.variable works just fine, assuming variable is a static member variable of Object. My current hack around this issue is to create a new instance of the object then call object.getClass() in python. Is there anyway to access "class" in python? - Peter -- "Now, now my good man, this is no time for making enemies." — Voltaire (1694-1778), on his deathbed in response to a priest asking that he renounce Satan. |