2012-06-12 72 views
0

我想使用BCEL 6.0-SNAPSHOT獲得我的CounterPersistence類的通用信息(Counter class)。簽名是這樣的:如何獲得使用BCEL的課程的通用信息?

public interface CounterPersistence extends BasePersistence<Counter> { 
.... 
} 

我用下面的代碼讀取的字節碼

JavaClass javaClass = ...; 
Attribute[] attributes = javaClass.getAttributes(); 
for (Attribute attribute : attributes) { 
    if (attribute instanceof Signature) { 
     Signature signature = (Signature) attribute; 
     //put the code here that get the Counter class from the signature 
    } 
} 

但我不能寫解析簽名代碼,並讓我獲得鍵入計數器。 想法?

+0

上面的代碼給我'Ljava /郎/對象; LCOM /的liferay /門戶/服務/持久/ BasePersistence ;簽名 –

回答

0

我找到了解決方案:

Class.forName(org.apache.bcel.classfile.Utility.methodSignatureArgumentTypes("(" + signature + ")V")[0]); 
相關問題