Antonio Goncalves created FORGE-1880:
----------------------------------------
Summary: Adding @Named to an EJBs... or any annotation anywhere
Key: FORGE-1880
URL:
https://issues.jboss.org/browse/FORGE-1880
Project: Forge
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Java EE
Affects Versions: 2.6.0.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
When I create an EJB with Forge with the following command :
{code}
ejb-new-bean --named MyService
{code}
I get the following :
{code}
@Stateless
@LocalBean
public class MyService implements Serializable
{code}
In some cases, I would need to add an extra {{@Named}} annotation. Several ways to do it.
On the EJB command itself, we could add a parameter :
{code}
ejb-new-bean --named MyService --addNamed
{code}
But I think it would be good to have something more generic that could be used anywhere.
We could use the same logic as constraint-add (that adds any kind of constraint on any
Entity) and have something like
{code}
cdi-add-qualifier --qualifier Named --target org.app.service.MyService
// or on a property, which could be useful
cdi-add-qualifier --qualifier Named --onProperty myProp
cdi-add-qualifier --qualifier Named --onMethod myMethod
{code}
Or something even more generic would be to use the Java command
{code}
java-add-annotation --annotation javax.inject.Named --target org.app.service.MyService
java-add-annotation --annotation javax.inject.Named --target org.app.service.MyService
--onProperty myProp
java-add-annotation --annotation javax.inject.Named --target org.app.service.MyService
--onMethod myMethod
java-add-annotation --annotation javax.inject.Named --onProperty myProp
java-add-annotation --annotation javax.inject.Named --onMethod myMethod
{code}
_Comments on the mailing list by Ivan_
_I think that java-add-annotation is a good command that we should have. But still it
would be better to have also something more explicit for creating named beans and setting
stereotypes. So, I think that the three levels of abstraction that Antonio described may
be implemented. Well, at the end they will reuse one and the same code for adding
annotation, so no repeating ourselves will occur._
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)