I'm having trouble with doubling up on my code for no reason other than my own lack of ability to do it more efficiently...
for (Method curr: all){
if (curr.isAnnotationPresent(anno)){
if (anno == Pre.class){
for (String str : curr.getAnnotation(Pre.class).value()){
if (str.equals(method.getName()) && curr.getReturnType() == boolean.class && curr.getParameterTypes().length == 0){
toRun.add(curr);
}
}
} if (anno == Post.class) {
for (String str : curr.getAnnotation(Post.class).value()){
if (str.equals(method.getName()) && curr.getReturnType() == boolean.class && curr.getParameterTypes().length == 0){
toRun.add(curr);
}
}
}
}
}
anno is a parameter - Class<? extends Annotation>
, and Pre
and Post
are my annotations, both have a value()
which is an array of strings.
Of course, this is all due to the fact that i let Eclipse auto fill code that i don't understand yet.