You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current customizer system works by adding or removing methods and base classes prior to the creation of the class. This is allowed to run arbitrary user code.
Limiting the types of actions to a fixed set of prescribed actions would make it much safer and ensure those actions take place consistently. It would also make it more future proof as the actions would be executed by the library code rather than by conventions.
The text was updated successfully, but these errors were encountered:
Plan of attack for this is to use decorators so that the system is entirely automated rather than a customizer class.
from jpype import SuperFor, ImplementationFor, JClass
#Insert JString into the class tree as a base class of java.lang.String
@SuperFor("java.lang.String")
class JString(JObject): # we must derive from JObject so that we will appear before it in the mro.
# This method will appear in the class tree
def doSomething(self):
pass
# All methods from this class will be copied into java.lang.Object when that class is created.
@ImplementationFor("java.lang.Object")
class MyObjectMethods(object):
# This method will appear in java.lang.Object class. It can either be a static method
# which will take either the class or the object as self or a method which will expect
# self to be an object.
def doSomething(self):
pass
To be resolved.
Will this work with the new style of decorator that is planned for python?
How to determine if it was called as a static method? Should be as easy as if isinstance(self, JClass): called static
The current customizer system works by adding or removing methods and base classes prior to the creation of the class. This is allowed to run arbitrary user code.
Limiting the types of actions to a fixed set of prescribed actions would make it much safer and ensure those actions take place consistently. It would also make it more future proof as the actions would be executed by the library code rather than by conventions.
The text was updated successfully, but these errors were encountered: