JDI/JPDA 事件过滤
在JDI中,有一个API可以从JPDA使用的JVM中处理的事件中排除事件。这是使用以下命令完成的:
addExclusionFilter(String)
排除某些模式;例如addExclusionFilter("java.*")
addClassFilter(String)
以包含一些模式;例如addClassFilter("java.util.*")
现在,我两者都需要。我需要排除来自 "java.*"
的所有事件,但我需要接收来自 "java.util.Iterator"
的事件。
另外,请注意,例如java.util.Iterator
是由java.util.AbstractList
中的某些私有类实现的接口。我们如何将此类事件接收到java.util.Iterator
?
当我使用这两种方法时,实际上我不再接收事件了。你知道该怎么做吗?提前致谢。
In JDI, there is the API to exclude events from processed events in JVM used by JPDA. This is done using:
addExclusionFilter(String)
to exclude some pattern; e.g.addExclusionFilter("java.*")
addClassFilter(String)
to include some pattern; e.g.addClassFilter("java.util.*")
Now, I need both. I need to exclude all events coming from "java.*"
but I need to receive events from "java.util.Iterator"
.
Also, note that for instance java.util.Iterator
is an interface implemented by some private class in java.util.AbstractList
. How do we receive such events to java.util.Iterator
?
When I used both methods, I actually do not receive events any more. Do you have an idea how to do that? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 addClassFilter 方法,该方法将 ReferenceType 作为参数,该方法(与 String-arg 版本不同)匹配给定类型的任何子类型。使用 jdiscript 和 Java 8,迭代器方法调用的触发可能类似于:
You can use the addClassFilter method that takes a ReferenceType as an argument, which (unlike the String-arg version) matches any subtype of the given type. With jdiscript and Java 8, firing on Iterator method calls could look something like: