示例#1
0
    def __init__(self, superclass, interfaces, className, pythonModuleName, fullProxyName, mapping, package, kwargs):
        self.package = package
        self.kwargs = kwargs
        
        log.debug("superclass=%s, interfaces=%s, className=%s, pythonModuleName=%s, fullProxyName=%s, mapping=%s, "
                  "package=%s, kwargs=%s", superclass, interfaces, className, pythonModuleName, fullProxyName, mapping,
                  package, kwargs)

        # FIXME break this out
        is_serializable = False
        inheritance = list(interfaces)
        if superclass:
            inheritance.append(superclass)
        for cls in inheritance:
            if issubclass(cls, Serializable):
                is_serializable = True

        if is_serializable:
            self.constants = { "serialVersionUID" : (java.lang.Long(1), java.lang.Long.TYPE) }
        else:
            self.constants = {}
        if "constants" in kwargs:
            self.constants.update(self.kwargs["constants"])
        self.updateConstantsFromMapping(mapping)

        CustomMaker.__init__(self, superclass, interfaces, className, pythonModuleName, fullProxyName, mapping)
示例#2
0
    def __init__(self, superclass, interfaces, className, pythonModuleName,
                 fullProxyName, mapping, package, kwargs):
        self.package = package
        self.kwargs = kwargs

        log.debug(
            "superclass=%s, interfaces=%s, className=%s, pythonModuleName=%s, fullProxyName=%s, mapping=%s, "
            "package=%s, kwargs=%s", superclass, interfaces, className,
            pythonModuleName, fullProxyName, mapping, package, kwargs)

        # FIXME break this out
        is_serializable = False
        inheritance = list(interfaces)
        if superclass:
            inheritance.append(superclass)
        for cls in inheritance:
            if issubclass(cls, Serializable):
                is_serializable = True

        if is_serializable:
            self.constants = {
                "serialVersionUID": (java.lang.Long(1), java.lang.Long.TYPE)
            }
        else:
            self.constants = {}
        if "constants" in kwargs:
            self.constants.update(self.kwargs["constants"])
        self.updateConstantsFromMapping(mapping)

        CustomMaker.__init__(self, superclass, interfaces, className,
                             pythonModuleName, fullProxyName, mapping)
示例#3
0
文件: clamp.py 项目: Britefury/jython
 def makeClass(self):
     try:
         # If already defined on CLASSPATH, simply return this class
         cls = java.lang.Class.forName(self.myClass)
         print "Class defined on CLASSPATH", cls
     except:
         # Otherwise build it
         cls = CustomMaker.makeClass(self)
     return cls
示例#4
0
 def makeClass(self):
     try:
         # If already defined on CLASSPATH, simply return this class
         cls = java.lang.Class.forName(self.myClass)
         print "Class defined on CLASSPATH", cls
     except:
         # Otherwise build it
         cls = CustomMaker.makeClass(self)
     return cls
示例#5
0
 def makeClass(self):
     print "Entering makeClass", self
     try:
         # If already defined on CLASSPATH, simply return this class
         cls = java.lang.Class.forName(self.myClass)
         print "Looked up proxy", self.myClass
     except:
         # Otherwise build it
         print "Calling super..."
         cls = CustomMaker.makeClass(self)
         print "Built proxy", self.myClass
     return cls
示例#6
0
 def makeClass(self):
     builder = get_builder()
     log.debug("Entering makeClass for %r", self)
     try:
         import sys
         log.debug("Current sys.path: %s", sys.path)
         # If already defined on sys.path (including CLASSPATH), simply return this class
         # if you need to tune this, derive accordingly from this class or create another CustomMaker
         cls = Py.findClass(self.myClass)
         log.debug("Looked up proxy: %r, %r", self.myClass, cls)
         if cls is None:
             raise TypeError("No proxy class")
     except:
         if builder:
             log.debug("Calling super... for %r", self.package)
             cls = CustomMaker.makeClass(self)
             log.info("Built proxy: %r", self.myClass)
         else:
             raise TypeError("Cannot clamp proxy class {} without a defined builder".format(self.myClass))
     return cls
示例#7
0
 def makeClass(self):
     global _builder
     print "Entering makeClass", self
     try:
         import sys
         print "sys.path", sys.path
         # If already defined on sys.path (including CLASSPATH), simply return this class
         # if you need to tune this, derive accordingly from this class or create another CustomMaker
         cls = Py.findClass(self.myClass)
         print "Looked up proxy", self.myClass, cls
         if cls is None:
             raise TypeError("No proxy class")
     except:
         if _builder:
             print "Calling super...", self.package
             cls = CustomMaker.makeClass(self)
             print "Built proxy", self.myClass
         else:
             raise TypeError("FIXME better err msg - Cannot construct class without a defined builder")
     return cls
示例#8
0
 def makeClass(self):
     builder = get_builder()
     log.debug("Entering makeClass for %r", self)
     try:
         import sys
         log.debug("Current sys.path: %s", sys.path)
         # If already defined on sys.path (including CLASSPATH), simply return this class
         # if you need to tune this, derive accordingly from this class or create another CustomMaker
         cls = Py.findClass(self.myClass)
         log.debug("Looked up proxy: %r, %r", self.myClass, cls)
         if cls is None:
             raise TypeError("No proxy class")
     except:
         if builder:
             log.debug("Calling super... for %r", self.package)
             cls = CustomMaker.makeClass(self)
             log.info("Built proxy: %r", self.myClass)
         else:
             raise TypeError(
                 "Cannot clamp proxy class {} without a defined builder".
                 format(self.myClass))
     return cls