Skip to content

Instantly share code, notes, and snippets.

@mojavelinux
Created October 21, 2010 23:28
Show Gist options
  • Save mojavelinux/639604 to your computer and use it in GitHub Desktop.
Save mojavelinux/639604 to your computer and use it in GitHub Desktop.
Extension to allow a bean to be declaratively vetoed
@Veto
DisabledBean
{
}
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Veto {}
public class VetoExtension implements Extension
{
<X> void processAnnotatedType(@Observes final ProcessAnnotatedType<X> event)
{
if (event.getAnnotatedType().isAnnotationPresent(Veto.class))
{
event.veto();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment