Skip to content

Instantly share code, notes, and snippets.

@Phocacius
Created January 28, 2015 15:32
Show Gist options
  • Save Phocacius/a1108fd1dd0a2742a459 to your computer and use it in GitHub Desktop.
Save Phocacius/a1108fd1dd0a2742a459 to your computer and use it in GitHub Desktop.
template for a method annotation processor
Method[] methods = this.getClass().getMethods();
for (Method method : methods) {
MyAnnotation annotation = method.getAnnotation(MyAnnotation.class);
if (annotation != null) {
Object myAnnotationAttribute = annotation.value();
// do whatever you want here
try {
method.invoke(this, methodParameters);
} catch (IllegalAccessException|InvocationTargetException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment