def __getattr__(self, name): try: return super(module, self).__getattribute__(name) except AttributeError as ae: try: clazz = findClass('{0}.{1}'.format(self.__name__, name)) setattr(self, name, clazz) return clazz except Exception: # should raise AttributeError, not JepException raise ae
def load_module(self, fullname): if fullname in sys.modules: return sys.modules[fullname] mod = module(fullname) mod.__dict__.update({ '__loader__': self, '__path__': [], '__file__': '<java>', }) sys.modules[fullname] = mod # list of classes in package classlist = self.classlist.get(fullname) if classlist: for name in classlist: setattr(mod, name.split('.')[-1], findClass(name)) return mod
def __init__(self): self.classlist = findClass('jep.ClassList').getInstance()