[java2python] r186 committed - Adds config handler for class, interface and enum bases.

3 views
Skip to first unread message

java2...@googlecode.com

unread,
Oct 30, 2011, 1:05:45 AM10/30/11
to java2pyth...@googlegroups.com
Revision: 186
Author: troy.melhase
Date: Sat Oct 29 22:05:12 2011
Log: Adds config handler for class, interface and enum bases.
http://code.google.com/p/java2python/source/detail?r=186

Modified:
/trunk/java2python/compiler/template.py
/trunk/java2python/config/default.py
/trunk/java2python/mod/basic.py

=======================================
--- /trunk/java2python/compiler/template.py Thu Oct 27 16:16:24 2011
+++ /trunk/java2python/compiler/template.py Sat Oct 29 22:05:12 2011
@@ -403,7 +403,9 @@

def iterBases(self):
""" Yields the base classes for this type. """
- return iter(self.bases or ['object'])
+ for handler in self.configHandlers('Base'):
+ for base in handler(self):
+ yield base

def iterDecl(self):
""" Yields the declaration for this type. """
=======================================
--- /trunk/java2python/config/default.py Thu Oct 27 16:16:24 2011
+++ /trunk/java2python/config/default.py Sat Oct 29 22:05:12 2011
@@ -48,6 +48,13 @@
basic.simpleDocString,
]

+classBaseHandlers = [
+ basic.defaultBases,
+]
+
+interfaceBaseHandlers = [
+ basic.zopeInterfaceBases,
+]

# These generators are called after a class has been completely
# generated. The class content sorter sorts the methods of a class by
=======================================
--- /trunk/java2python/mod/basic.py Thu Oct 27 16:16:24 2011
+++ /trunk/java2python/mod/basic.py Sat Oct 29 22:05:12 2011
@@ -172,3 +172,10 @@
if method.parameters and method.parameters[0]['name'] == 'self':
method.parameters.pop(0)

+
+def defaultBases(obj):
+ return iter(obj.bases or ['object'])
+
+
+def zopeInterfaceBases(obj):
+ return ['zope.interface.Interface']

Reply all
Reply to author
Forward
0 new messages