从Perl或Python解析Java类 [英] Parsing Java Class From Perl or Python
本文介绍了从Perl或Python解析Java类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取.java文件,识别文件中的第一个类,并从此类中获取有关注释,方法和属性的信息。
I want to get a .java file, recognize the first class in the file, and get information about annotations, methods and attributes from this class.
是否存在两种语言中的任何模块都已经这样做了吗?
我可以建立一个简单的正则表达式,但我不知道如何在正则表达式中识别指示类/方法结束的大括号。
Is there any module in both languages that already does that? I could build up a simple regexp to do it also, but I don't known how to recognize in the regexp the braces indicating the end of the class/method.
推荐答案
如果你在 Jython 中加载java类你可能会使用内省来找到你需要的信息。
If you load the java classes inside Jython you probably could use introspection to find the information you need.
这篇关于从Perl或Python解析Java类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文