Question
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.
Solution 2
I found the answer in VisualVM OQL help.
select filter(heap.classes(), "/com.example./(it.name)")
OTHER TIPS
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.
From VisualVM limited documentation:
- select all classes that have name pattern java.net.*
select filter(heap.classes(), "/java.net./.test(it.name)")
https://visualvm.github.io/documentation.html
The trick is in the "test(it.name)"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow