def visitInterface (self, node):
package = qualifiedName(node.scopedName()[:-1] + ['jni'])
# Ensure the directory structure is there
path = os.path.join(*package.split('.'))
try:
os.makedirs(path)
except OSError, e:
# If the leaf directory already existed (or was created in the
# interim), ignore the error
if e.errno != errno.EEXIST:
raise
# Override library name with argument
libname = self.__options.get('libname', None)
if not libname:
libname = node.scopedName()[-2].lower() + 'jni'
# Generate the stub
stubCode = StubClass(package, libname).generate(node)
stubFile = os.path.join(path, stubName(node) + '.java')
stubCode.write(javacode.SourceFile(open(stubFile, 'w')))
# Generate the helper
interface = qualifiedName(node.scopedName())
helperCode = HelperClass(package, interface).generate(node)
helperFile = os.path.join(path, helperName(node) + '.java')
helperCode.write(javacode.SourceFile(open(helperFile, 'w')))
# Generate the POA
poaCode = POAClass(package, libname).generate(node)
poaFile = os.path.join(path, poaName(node) + '.java')
poaCode.write(javacode.SourceFile(open(poaFile, 'w')))
评论列表
文章目录