Details
-
Type:
Feature Request
-
Status: Resolved (View Workflow)
-
Priority:
Minor
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 3.0.0.Beta1
-
Component/s: Core
-
Labels:None
-
Affects:Documentation (Ref Guide, User Guide, etc.)
-
Estimated Difficulty:Low
-
Git Pull Request:
Description
The HandlesExceptions should be permitted on a stereotype so annotations can be consolidated.
Gliffy Diagrams
Issue Links
- is blocked by
-
SOLDER-52
Add methods to AnnotationInspector that operate on Annotated (from CDI)
-
- Resolved
-
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)
{ return true; }{
if (annotated.isAnnotationPresent(annotationType))
for (Annotation candidate : annotated.getAnnotations())
{ return true; }{
if (beanManager.isStereotype(candidate.annotationType()))
{
for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType()))
{
if (stereotyped.annotationType().equals(annotationType))
}
}
}
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
{ TYPE }@Stereotype
@Target(
)
@Retention(RUNTIME)
@Documented
public @interface GetYourHandlersHere {}
@GetYourHandlersHere
public class StereotypedExceptionHandler
{
public void handlesAll(@Handles CaughtException<Throwable> caught)
{
}
}