Skip to content

Instantly share code, notes, and snippets.

@antoinesd
Created April 17, 2012 17:13
Show Gist options
  • Save antoinesd/2407572 to your computer and use it in GitHub Desktop.
Save antoinesd/2407572 to your computer and use it in GitHub Desktop.
<X> void processAnnotatedType(@Observes final ProcessAnnotatedType<X> pat, BeanManager beanManager) {
final AnnotatedType<X> annotatedType = pat.getAnnotatedType();
final Class<X> javaClass = annotatedType.getJavaClass();
final Package pkg = javaClass.getPackage();
// Support for @Veto
if (annotatedType.isAnnotationPresent(Veto.class) || (pkg != null && pkg.isAnnotationPresent(Veto.class))) {
pat.veto();
log.info("Preventing " + javaClass + " from being installed as bean due to @Veto annotation");
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment