Andi Vajda <va...@apache.org> wrote: > > OK, I'll try the static method, then. What do you think about wrapping > > protected methods of classes marked as Python-extensible? > > Not much but I haven't given it much thought. At this point, I just go > over public things... That code is in cpp.py and there may be more in > there already about looking at all methods.
Theoretically, though, Python subclasses should be able to access and override protected methods of the Java parent class. What I wound up doing is this: public abstract class Regex { public static Regex compile(String pattern) { PythonVM vm = org.apache.jcc.PythonVM.start(...); PythonExtensibleRegex r = (PythonExtensibleRegex) vm.instantiate(...); if (pattern != null) r.initialize(pattern); return r; } private static PythonExtensibleRegex _static = null; public static String escape (String s) { if (_static == null) { _static = (PythonExtensibleRegex) compile(null); } return _static.internalescape(s); } ... } public class PythonExtensibleRegex extends Regex { ... public native String internalescape (String s); ... } So the data hiding is happening, it's just a bit messy. Bill