I want to search declared methods
by flags and other informations.
For example, i want to search the Method public final void ae(StringTokenizer);
.
Here is a sample method, how i want to search it:
private CtMethod findMethod(CtClass clazz, int access, String returns, String[] parameters) throws NotFoundException {
/*
returns = null = void, other String for returned class name
parameters = easy names of parameters
*/
CtMethod found = null;
for(CtMethod method : clazz.getDeclaredMethods()) {
// Check here all flags and informations - If found, set the `found` variable and return
}
return found;
}
Here is a sample call:
CtMethod inputMethod = this.findMethod(theClass, AccessFlag.FINAL, null, new String[] { "StringTokenizer" });
How i can check the explicit flags, for sample AccessFlag.FINAL | AccessFlag.PUBLIC
?