OQL all instances from a package

大兔子大兔子 提交于 2019-12-11 03:08:35

问题


Is it possible in OQL to retrieve all the objects that belongs to a package? Or can I query with wildcards?

As @haridsv suggested I tried:

SELECT * from "com.example.*"

and

SELECT a from "com\.example\..*"

but in VisualVM it complaints that no such package exists.

Even

SELECT a from "java.io.File" a

Fails.

Thanks!

ssedano.


回答1:


I found the answer in VisualVM OQL help.

select filter(heap.classes(), "/com.example./(it.name)")



回答2:


You can use regular expression like this:

SELECT * from "<packagename>.*"

If the package name is "java.io" you would use:

SELECT * from "java\.io\..*"

Note the quotes around the regex and how the dots in the path are protected.



来源:https://stackoverflow.com/questions/12385185/oql-all-instances-from-a-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!