Consider we have a class
public class MyTest() {
@Inject private Class1 class1;
@Inject private Class2 class2;
}
and a class
public class MyTest2() {
@Inject private Class1 class1;
@Inject private Class2 class2;
@Inject private Class3 class3;
}
I want to find all classes that inject class1
and class2
and DO NOT inject class3
. I've tried to use Structural search from IntelliJ but got stuck. Is it doable with structural search?
Maybe by using search template:
class $a$ {
@Inject private Class1 $_1$;
@Inject private Class1 $_2$;
$3$;
}
and search text filters for $_1$ $_2$ and $_3$: respectively
text=class1
text=class2
text=!@Inject private Class1 class3;
I am (still) not sure I understand the problem correctly, but you could try something like this:
class $X$ {
@Inject private Class1 $a$;
@Inject private Class2 $b$;
@Inject private Class3 $c$;
}
And add a count filter [0,0]
on $c$
.
This will find classes that have Class1
and Class2
fields, but do not have a Class3
field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.