When using a reference in a structural search, how do I filter its fields?

限于喜欢 提交于 2019-12-11 07:19:46

问题


I've found how to search for all fields and variables of a type that implements a given interface, in my case AutoCloseable.

My current way to do this is first creating a filter for classes that implement AutoCloseable. This filter is derived from the pre-defined filter "implementors of interface (within hierarchy)" by adding a filter on the Interface.

class $Class$ implements $Interface$ {} where $Interface$ is filtered with text=AutoCloseable.

After saving that filter as "AutoCloseableFilter", I use another filter that uses it:

$FieldType$ where $FieldType$ is filtered with reference=AutoCloseableFilter.

That works, but I'd like to be able to skip the step of saving a specific instance of that pre-defined filter, instead setting its filter when using it as a reference.

In other words, I'd like to create a filter where $FieldType is filtered by reference=implementors of interface (within hierarchy) and then filtering $Interface$ to a specific interface in one go.

Is that possible in structural search?


回答1:


For your use case it appears to be enough to specify a text filter on $FieldType$ instead of a reference filter. Use text AutoCloseable and check the Within type hierarchy checkbox.



来源:https://stackoverflow.com/questions/53759638/when-using-a-reference-in-a-structural-search-how-do-i-filter-its-fields

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