Re: [Py4j-users] How to access "class"
Status: Beta
Brought to you by:
barthe
From: Alex G. <ale...@ne...> - 2015-07-16 04:20:38
|
The .class is a kludge to access the actual class in Java. In Python, simply leave out the ".class". if object.getClass() == Object: # do something 16.07.2015, 03:18, Peter A kirjoitti: > 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 handgateway.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. > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > > > _______________________________________________ > Py4j-users mailing list > Py4...@li... > https://lists.sourceforge.net/lists/listinfo/py4j-users |