[forge-issues] [JBoss JIRA] (FORGE-2225) Being able to add a new CDI producer method to an existing class
Antonio Goncalves (JIRA)
issues at jboss.org
Tue Aug 25 16:58:43 EDT 2015
[ https://issues.jboss.org/browse/FORGE-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonio Goncalves updated FORGE-2225:
-------------------------------------
Description:
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}
was:
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-new-producer-method --named produceLogger --type org.apache.logging.log4j.Logger --accessType private
{code}
Would generate :
{code}
public class LoggingProducer
{
@Produces
public Logger produceLogger() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
{code}
We can also have a parameter to add the injection point
{code}
cdi-new-producer-method --named produceLogger --type org.apache.logging.log4j.Logger --accessType private --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}
> 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
> Fix For: 2.x Future
>
>
> 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
(v6.3.15#6346)
More information about the forge-issues
mailing list