I'd like to subclass / inherit Java types from within Python, however this seems not to work:
Example:
import jpyutil
jpyutil.init_jvm()
import jpy
BigInteger = jpy.get_type("java.math.BigInteger")
print(BigInteger("1")) # works
class MyBigInteger(BigInteger):
def additionalMethod(self):
print("...")
print(MyBigInteger("1")) # does not work
Yields
RuntimeError: no constructor found (missing JType attribute '__jinit__')
Am I doing something wrong? Is there any easy work-around for the situation? (Theoretically one proxy all calls etc., but I'd prefer if Python's OOP would remain intact)
(Actually, I'd like to override certain Java-land methods and feed the subclassed object back to the Java-land, to be able to easily call them by the parent object's definition …)
I'd like to subclass / inherit Java types from within Python, however this seems not to work: Example:
Yields
(Any relation to https://github.com/bcdev/jpy/issues/155 ?)
Am I doing something wrong? Is there any easy work-around for the situation? (Theoretically one proxy all calls etc., but I'd prefer if Python's OOP would remain intact) (Actually, I'd like to override certain Java-land methods and feed the subclassed object back to the Java-land, to be able to easily call them by the parent object's definition …)