[seam-issues] [JBoss JIRA] Commented: (SEAMCATCH-24) Honor the use of HandlesExceptions on a stereotype
Dan Allen (JIRA)
jira-events at lists.jboss.org
Thu Dec 9 02:31:31 EST 2010
[ https://jira.jboss.org/browse/SEAMCATCH-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568874#comment-12568874 ]
Dan Allen commented on SEAMCATCH-24:
------------------------------------
Add this utility method to CatchExtension (should be pushed into Solder eventually)
public static <A extends Annotation> boolean isAnnotationPresent(Annotated annotated, final Class<A> annotationType, BeanManager beanManager)
{
if (annotated.isAnnotationPresent(annotationType))
{
return true;
}
for (Annotation candidate : annotated.getAnnotations())
{
if (beanManager.isStereotype(candidate.annotationType()))
{
for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType()))
{
if (stereotyped.annotationType().equals(annotationType))
{
return true;
}
}
}
}
return false;
}
Then replace the line that checks for HandlesExceptions
if (isAnnotationPresent(type, HandlesExceptions.class, bm))
Here are two classes to use for a test
@HandlesExceptions
@Stereotype
@Target({ TYPE })
@Retention(RUNTIME)
@Documented
public @interface GetYourHandlersHere {}
@GetYourHandlersHere
public class StereotypedExceptionHandler
{
public void handlesAll(@Handles CaughtException<Throwable> caught)
{
}
}
> Honor the use of HandlesExceptions on a stereotype
> --------------------------------------------------
>
> Key: SEAMCATCH-24
> URL: https://jira.jboss.org/browse/SEAMCATCH-24
> Project: Seam Catch
> Issue Type: Feature Request
> Components: Core Implementation
> Affects Versions: Alpha2
> Reporter: Dan Allen
> Assignee: Jason Porter
> Priority: Minor
> Fix For: Alpha3
>
>
> The HandlesExceptions should be permitted on a stereotype so annotations can be consolidated.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list