[JBoss JIRA] (FORGE-2225) Being able to add a new CDI producer method to an existing class
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2225?page=com.atlassian.jira.plugin... ]
George Gastaldi closed FORGE-2225.
----------------------------------
Fix Version/s: 3.7.3.Final
(was: 3.x Future)
Resolution: Done
> Being able to add a new CDI producer method to an existing class
> ----------------------------------------------------------------
>
> Key: FORGE-2225
> URL: https://issues.jboss.org/browse/FORGE-2225
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.14.0.Final
> Reporter: Antonio Goncalves
> Assignee: Martin Kouba
> Fix For: 3.7.3.Final
>
>
> It would be good to have a command to add a CDI producer method to an existing class. A simple command such as :
> {code}
> cdi-add-producer-method --named produceLogger --type org.apache.logging.log4j.Logger --targetClass LoggingProducer
> {code}
> Would generate :
> {code}
> public class LoggingProducer
> {
> @Produces
> public Logger produceLogger() {
> throw new UnsupportedOperationException("Not supported yet.");
> }
> }
> {code}
> The method is by default private, but we could change this :
> {code}
> cdi-add-producer-method --named produceLogger --type org.apache.logging.log4j.Logger --targetClass LoggingProducer --accessType private
> {code}
> We can also have a parameter to add the injection point
> {code}
> cdi-add-producer-method --named produceLogger --type org.apache.logging.log4j.Logger --targetClass LoggingProducer --injectionPoint
> {code}
> Would generate :
> {code}
> public class LoggingProducer
> {
> @Produces
> public Logger produceLogger(InjectionPoint injectionPoint) {
> throw new UnsupportedOperationException("Not supported yet.");
> }
> }
> {code}
> Then, we can have more attributes :
> {code}
> cdi-new-producer-method --named produceLogger --returnType org.apache.logging.log4j.Logger --accessType private --injectionPoint --qualifier Production --alternative=true --scoped Request --atNamed=true
> {code}
> {code}
> public class LoggingProducer
> {
> @Produces
> @Production
> @Alternative
> @RequestScoped
> @Named
> public Logger produceLogger() {
> throw new UnsupportedOperationException("Not supported yet.");
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)