2
A
回答
5
類的從包將在classNameOfCurrentBundle列表中端名稱:轉換一個className類類型
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
// Getting all the class files (also from imported packages)
Collection<String> resources = bundleWiring.listResources("/", "*.class", BundleWiring.LISTRESOURCES_RECURSE);
List<String> classNamesOfCurrentBundle = new ArrayList<String>();
for (String resource : resources) {
URL localResource = bundle.getEntry(resource);
// Bundle.getEntry() returns null if the resource is not located in the specific bundle
if (localResource != null) {
String className = resource.replaceAll("/", ".");
classNamesOfCurrentBundle.add(className);
}
}
:
bundle.loadClass(className);
+0
請參閱問題http://stackoverflow.com/questions/37895399/get-bundle-classes-of-private-packages-in-another-bundle –
相關問題
- 1. 如何獲得具有給定屬性的所有Unicode字符的列表?
- 2. 如何獲得在給定日期有效的所有CouchDB文檔的列表?
- 3. 如何獲得「參與」給定對象的所有類?
- 4. 如何獲得一個.py文件中所有類的列表?
- 5. 如何獲得.kt文件中所有類的列表
- 6. 查找給定包中的所有類
- 7. 如何獲得所有類的列表符合XCode 4中的特定協議?
- 8. 如何獲得包含所有Actionscript 3 api名稱的列表?
- 9. 如何獲得列表中所有密鑰的密鑰列表?
- 10. 如何獲得sqlite 3中給定表的所有列名的列表? (表可能是空的)
- 11. R獲得列中的所有類別
- 12. 如何列出給定類中包含和繼承的所有類?
- 13. 如何獲得包括視圖列的MS SQL的所有列
- 14. 列出實現給定接口的包中的所有類
- 15. 如何獲取列表中特定類型的所有對象?
- 16. 如何獲得所有文檔類型的列表
- 17. 如何獲得c#上所有SQl數據類型的列表?
- 18. 如何列出python文件中給定類型的所有類?
- 19. 如何獲得具有給定標籤ID的線程列表?
- 20. 如何獲取給定網址的所有aspx頁面列表
- 21. 使用Twitter,我如何獲得包含特定URL的所有推文列表?
- 22. 如何獲得C中給定月份的所有日期#
- 23. 如何獲得特定表的所有列ucanaccess
- 24. 如何獲得的子項列表中的給定鍵
- 25. Symfony:如何獲得具有給定模板的所有模型?
- 26. 如何從包含數值的所有列的表中獲得最大值
- 27. Qt:如何獲得特定類的兒童的所有類
- 28. 如何獲得從給定類派生的類的列表,增強了RTTI?
- 29. 如何獲取包含所有dba包的描述的列表
- 30. 如何獲得列表中的所有可能的訂單
編程? –
例如,來自JUnit插件測試(不是來自Eclipse GUI界面)。 – dzav