[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1117) support enum types in @RaiseEvent or a new @RaiseEventType annotation

Gavin King (JIRA) jira-events at lists.jboss.org
Tue Mar 27 17:13:35 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-1117?page=comments#action_12357538 ] 
            
Gavin King commented on JBSEAM-1117:
------------------------------------

No on the first request, its not possible for an annotation to have a member of type Annotation.

Yes on the second request.

> support enum types in @RaiseEvent or a new @RaiseEventType annotation
> ---------------------------------------------------------------------
>
>                 Key: JBSEAM-1117
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1117
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>            Reporter: Bradley Smith
>
> RaiseEvent:
> @Target(METHOD)
> @Retention(RUNTIME)
> @Documented
> public @interface RaiseEvent 
> {
>    
>    /**
>     * The event name, defaults to the name
>     * of the method.
>     * 
>     * @return the event name
>     */
>    String value() default "";
>    
>    //TODO: String[] ifOutcome() default {};
>    
> }
> Is it possible to make the value be based on an enum type?  I currently have all my application event types enumerated in enum called EventType.
> I've tried doing:  
> @RaiseEvent(EventType.ApplicationSaved.name())
> however, this doesn't count as a constant String and is invalid syntax.  It seems more 'elegant' to be able to enumerate the event types of an application in something like an enum than to sprinkle strings throughout the code with the specific event String values.
> Maybe an alternate annotation is called for - say, @RaiseEventType(MyEnum.MyEventType)?
> I'm not sure - I don't have a solid grasp of the syntax used to define an annotation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list