Created
October 21, 2010 23:28
-
-
Save mojavelinux/639604 to your computer and use it in GitHub Desktop.
Extension to allow a bean to be declaratively vetoed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Veto | |
DisabledBean | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Target(ElementType.TYPE) | |
@Retention(RetentionPolicy.RUNTIME) | |
@Documented | |
public @interface Veto {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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