[JBoss JIRA] (FORGE-2098) Being able to create a new JPA converter
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-2098?page=com.atlassian.jira.plugin... ]
Antonio Goncalves updated FORGE-2098:
-------------------------------------
Description:
It would be good to be able to create a new JPA converter with just the following command :
{code}
jpa-new-converter --name CreditCardConverter --fromAttribute CreditCard --toColumn String
{code}
This will generate the following code :
{code}
@Converter(autoApply = true)
public class CreditCardConverter implements AttributeConverter<CreditCard, String> {
@Override
public String convertToDatabaseColumn(CreditCard entityAttribute) {
return null;
}
@Override
public CreditCard convertToEntityAttribute(String databaseColumn) {
return null;
}
}
{code}
(!) This command is only available in JPA 2.1
We need [] to parameterize the {{Converter}} API. So the following code doesn't work, but it's a good start :
{code}
public class JPANewConverterCommand extends AbstractJPACommand<JavaClassSource>
{
@Inject
@WithAttributes(label = "Custom Scope Annotation", type = InputType.JAVA_CLASS_PICKER, required = true)
private UIInput<String> fromAttribute;
@Inject
@WithAttributes(label = "Custom Scope Annotation", type = InputType.JAVA_CLASS_PICKER, required = true)
private UIInput<String> toColumn;
@Override
public Metadata getMetadata(UIContext context)
{
return Metadata.from(super.getMetadata(context), getClass())
.name("JPA: New Converter")
.description("Create a new JPA Converter");
}
@Override
protected String getType()
{
return "Converter";
}
@Override
protected Class<JavaClassSource> getSourceType()
{
return JavaClassSource.class;
}
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
super.initializeUI(builder);
builder.add(fromAttribute).add(toColumn);
}
@Override
public JavaClassSource decorateSource(UIExecutionContext context, Project project, JavaClassSource source)
throws Exception
{
// Class
source.addInterface(AttributeConverter.class).addAnnotation(Converter.class).setLiteralValue("autoApply", "true");
// Methods
source.addMethod().setPublic().setName("convertToDatabaseColumn")
.setReturnType(toColumn.getValue())
.setParameters(fromAttribute.getValue() + " entityAttribute")
.setBody("return null;")
.addAnnotation(Override.class);
source.addMethod().setPublic().setName("convertToEntityAttribute")
.setReturnType(fromAttribute.getValue())
.setParameters(toColumn.getValue() + " databaseColumn")
.setBody("return null;")
.addAnnotation(Override.class);
return source;
}
}
{code}
{code}
@RunWith(Arquillian.class)
public class JPANewConverterCommandTest
{
@Deployment
@AddonDependencies({
@AddonDependency(name = "org.jboss.forge.addon:ui-test-harness"),
@AddonDependency(name = "org.jboss.forge.addon:shell-test-harness"),
@AddonDependency(name = "org.jboss.forge.addon:javaee"),
@AddonDependency(name = "org.jboss.forge.addon:maven"),
@AddonDependency(name = "org.jboss.forge.furnace.container:cdi")
})
public static AddonArchive getDeployment()
{
return ShrinkWrap.create(AddonArchive.class).addBeansXML().addClass(ProjectHelper.class);
}
@Inject
private UITestHarness uiTestHarness;
@Inject
private ShellTest shellTest;
@Inject
private ProjectHelper projectHelper;
@Inject
private FacetFactory facetFactory;
private Project project;
@Before
public void setUp()
{
project = projectHelper.createJavaLibraryProject();
projectHelper.installJPA_2_1(project);
}
@Test
public void checkCommandMetadata() throws Exception
{
try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
project.getRoot()))
{
controller.initialize();
// Checks the command metadata
assertTrue(controller.getCommand() instanceof JPANewConverterCommand);
UICommandMetadata metadata = controller.getMetadata();
assertEquals("JPA: New Converter", metadata.getName());
assertEquals("Java EE", metadata.getCategory().getName());
assertEquals("JPA", metadata.getCategory().getSubCategory().getName());
assertFalse("Project is created, shouldn't have targetLocation", controller.hasInput("targetLocation"));
assertEquals(5, controller.getInputs().size());
assertTrue(controller.hasInput("named"));
assertTrue(controller.hasInput("targetPackage"));
assertTrue(controller.hasInput("fromAttribute"));
assertTrue(controller.hasInput("toColumn"));
assertTrue(controller.getValueFor("targetPackage").toString().endsWith(DEFAULT_ENTITY_PACKAGE));
}
}
@Test
public void checkCommandShell() throws Exception
{
shellTest.getShell().setCurrentResource(project.getRoot());
Result result = shellTest.execute(("jpa-new-converter --named Dummy --fromAttribute java.lang.String --toColumn java.lang.Integer"), 10, TimeUnit.SECONDS);
Assert.assertThat(result, not(instanceOf(Failed.class)));
Assert.assertTrue(project.hasFacet(JPAFacet.class));
}
@Test
public void testCreateConverter() throws Exception
{
facetFactory.install(project, JavaSourceFacet.class);
try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
project.getRoot()))
{
controller.initialize();
controller.setValueFor("named", "CreditCardConverter");
controller.setValueFor("fromAttribute", "java.lang.String");
controller.setValueFor("toColumn", "java.lang.Integer");
controller.setValueFor("targetPackage", "org.jboss.forge.test");
Assert.assertTrue(controller.isValid());
Assert.assertTrue(controller.canExecute());
Result result = controller.execute();
Assert.assertThat(result, is(not(instanceOf(Failed.class))));
}
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.CreditCardConverter");
Assert.assertTrue(javaResource.exists());
Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
Assert.assertTrue(javaResource.getJavaType().hasAnnotation(Converter.class));
}
@Test
public void testCreateConverterDefaultPackage() throws Exception
{
facetFactory.install(project, JavaSourceFacet.class);
try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
project.getRoot()))
{
controller.initialize();
controller.setValueFor("named", "CreditCardConverter");
controller.setValueFor("fromAttribute", "java.lang.String");
controller.setValueFor("toColumn", "java.lang.Integer");
Assert.assertTrue(controller.isValid());
Assert.assertTrue(controller.canExecute());
Result result = controller.execute();
Assert.assertThat(result, is(not(instanceOf(Failed.class))));
}
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
String packageName = project.getFacet(JavaSourceFacet.class).getBasePackage() + "." + DEFAULT_ENTITY_PACKAGE;
JavaResource javaResource = facet.getJavaResource(packageName + ".CreditCardConverter");
Assert.assertTrue(javaResource.exists());
Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
Assert.assertTrue(javaResource.getJavaType().hasAnnotation(Converter.class));
}
@Test
public void testCreateConverterWithNoMandatoryAttribute() throws Exception
{
facetFactory.install(project, JavaSourceFacet.class);
try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
project.getRoot()))
{
controller.initialize();
controller.setValueFor("named", "CreditCardConverter");
controller.setValueFor("targetPackage", "org.jboss.forge.test");
Assert.assertFalse(controller.isValid());
}
}
}
{code}
was:
It would be good to be able to create a new JPA converter with just the following command :
{code}
jpa-new-converter --name CreditCardConverter --fromAttribute CreditCard --toColumn String
{code}
This will generate the following code :
{code}
@Converter(autoApply = true)
public class CreditCardConverter implements AttributeConverter<CreditCard, String> {
@Override
public String convertToDatabaseColumn(CreditCard entityAttribute) {
return null;
}
@Override
public CreditCard convertToEntityAttribute(String databaseColumn) {
return null;
}
}
{code}
(!) This command is only available in JPA 2.1
> Being able to create a new JPA converter
> ----------------------------------------
>
> Key: FORGE-2098
> URL: https://issues.jboss.org/browse/FORGE-2098
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.12.1.Final
> Reporter: Antonio Goncalves
> Assignee: Antonio Goncalves
> Fix For: 2.x Future
>
>
> It would be good to be able to create a new JPA converter with just the following command :
> {code}
> jpa-new-converter --name CreditCardConverter --fromAttribute CreditCard --toColumn String
> {code}
> This will generate the following code :
> {code}
> @Converter(autoApply = true)
> public class CreditCardConverter implements AttributeConverter<CreditCard, String> {
> @Override
> public String convertToDatabaseColumn(CreditCard entityAttribute) {
> return null;
> }
> @Override
> public CreditCard convertToEntityAttribute(String databaseColumn) {
> return null;
> }
> }
> {code}
> (!) This command is only available in JPA 2.1
> We need [] to parameterize the {{Converter}} API. So the following code doesn't work, but it's a good start :
> {code}
> public class JPANewConverterCommand extends AbstractJPACommand<JavaClassSource>
> {
> @Inject
> @WithAttributes(label = "Custom Scope Annotation", type = InputType.JAVA_CLASS_PICKER, required = true)
> private UIInput<String> fromAttribute;
> @Inject
> @WithAttributes(label = "Custom Scope Annotation", type = InputType.JAVA_CLASS_PICKER, required = true)
> private UIInput<String> toColumn;
> @Override
> public Metadata getMetadata(UIContext context)
> {
> return Metadata.from(super.getMetadata(context), getClass())
> .name("JPA: New Converter")
> .description("Create a new JPA Converter");
> }
> @Override
> protected String getType()
> {
> return "Converter";
> }
> @Override
> protected Class<JavaClassSource> getSourceType()
> {
> return JavaClassSource.class;
> }
> @Override
> public void initializeUI(UIBuilder builder) throws Exception
> {
> super.initializeUI(builder);
> builder.add(fromAttribute).add(toColumn);
> }
> @Override
> public JavaClassSource decorateSource(UIExecutionContext context, Project project, JavaClassSource source)
> throws Exception
> {
> // Class
> source.addInterface(AttributeConverter.class).addAnnotation(Converter.class).setLiteralValue("autoApply", "true");
> // Methods
> source.addMethod().setPublic().setName("convertToDatabaseColumn")
> .setReturnType(toColumn.getValue())
> .setParameters(fromAttribute.getValue() + " entityAttribute")
> .setBody("return null;")
> .addAnnotation(Override.class);
> source.addMethod().setPublic().setName("convertToEntityAttribute")
> .setReturnType(fromAttribute.getValue())
> .setParameters(toColumn.getValue() + " databaseColumn")
> .setBody("return null;")
> .addAnnotation(Override.class);
> return source;
> }
> }
> {code}
> {code}
> @RunWith(Arquillian.class)
> public class JPANewConverterCommandTest
> {
> @Deployment
> @AddonDependencies({
> @AddonDependency(name = "org.jboss.forge.addon:ui-test-harness"),
> @AddonDependency(name = "org.jboss.forge.addon:shell-test-harness"),
> @AddonDependency(name = "org.jboss.forge.addon:javaee"),
> @AddonDependency(name = "org.jboss.forge.addon:maven"),
> @AddonDependency(name = "org.jboss.forge.furnace.container:cdi")
> })
> public static AddonArchive getDeployment()
> {
> return ShrinkWrap.create(AddonArchive.class).addBeansXML().addClass(ProjectHelper.class);
> }
> @Inject
> private UITestHarness uiTestHarness;
> @Inject
> private ShellTest shellTest;
> @Inject
> private ProjectHelper projectHelper;
> @Inject
> private FacetFactory facetFactory;
> private Project project;
> @Before
> public void setUp()
> {
> project = projectHelper.createJavaLibraryProject();
> projectHelper.installJPA_2_1(project);
> }
> @Test
> public void checkCommandMetadata() throws Exception
> {
> try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
> project.getRoot()))
> {
> controller.initialize();
> // Checks the command metadata
> assertTrue(controller.getCommand() instanceof JPANewConverterCommand);
> UICommandMetadata metadata = controller.getMetadata();
> assertEquals("JPA: New Converter", metadata.getName());
> assertEquals("Java EE", metadata.getCategory().getName());
> assertEquals("JPA", metadata.getCategory().getSubCategory().getName());
> assertFalse("Project is created, shouldn't have targetLocation", controller.hasInput("targetLocation"));
> assertEquals(5, controller.getInputs().size());
> assertTrue(controller.hasInput("named"));
> assertTrue(controller.hasInput("targetPackage"));
> assertTrue(controller.hasInput("fromAttribute"));
> assertTrue(controller.hasInput("toColumn"));
> assertTrue(controller.getValueFor("targetPackage").toString().endsWith(DEFAULT_ENTITY_PACKAGE));
> }
> }
> @Test
> public void checkCommandShell() throws Exception
> {
> shellTest.getShell().setCurrentResource(project.getRoot());
> Result result = shellTest.execute(("jpa-new-converter --named Dummy --fromAttribute java.lang.String --toColumn java.lang.Integer"), 10, TimeUnit.SECONDS);
> Assert.assertThat(result, not(instanceOf(Failed.class)));
> Assert.assertTrue(project.hasFacet(JPAFacet.class));
> }
> @Test
> public void testCreateConverter() throws Exception
> {
> facetFactory.install(project, JavaSourceFacet.class);
> try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
> project.getRoot()))
> {
> controller.initialize();
> controller.setValueFor("named", "CreditCardConverter");
> controller.setValueFor("fromAttribute", "java.lang.String");
> controller.setValueFor("toColumn", "java.lang.Integer");
> controller.setValueFor("targetPackage", "org.jboss.forge.test");
> Assert.assertTrue(controller.isValid());
> Assert.assertTrue(controller.canExecute());
> Result result = controller.execute();
> Assert.assertThat(result, is(not(instanceOf(Failed.class))));
> }
> JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
> JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.CreditCardConverter");
> Assert.assertTrue(javaResource.exists());
> Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
> Assert.assertTrue(javaResource.getJavaType().hasAnnotation(Converter.class));
> }
> @Test
> public void testCreateConverterDefaultPackage() throws Exception
> {
> facetFactory.install(project, JavaSourceFacet.class);
> try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
> project.getRoot()))
> {
> controller.initialize();
> controller.setValueFor("named", "CreditCardConverter");
> controller.setValueFor("fromAttribute", "java.lang.String");
> controller.setValueFor("toColumn", "java.lang.Integer");
> Assert.assertTrue(controller.isValid());
> Assert.assertTrue(controller.canExecute());
> Result result = controller.execute();
> Assert.assertThat(result, is(not(instanceOf(Failed.class))));
> }
> JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
> String packageName = project.getFacet(JavaSourceFacet.class).getBasePackage() + "." + DEFAULT_ENTITY_PACKAGE;
> JavaResource javaResource = facet.getJavaResource(packageName + ".CreditCardConverter");
> Assert.assertTrue(javaResource.exists());
> Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
> Assert.assertTrue(javaResource.getJavaType().hasAnnotation(Converter.class));
> }
> @Test
> public void testCreateConverterWithNoMandatoryAttribute() throws Exception
> {
> facetFactory.install(project, JavaSourceFacet.class);
> try (CommandController controller = uiTestHarness.createCommandController(JPANewConverterCommand.class,
> project.getRoot()))
> {
> controller.initialize();
> controller.setValueFor("named", "CreditCardConverter");
> controller.setValueFor("targetPackage", "org.jboss.forge.test");
> Assert.assertFalse(controller.isValid());
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months
[JBoss JIRA] (FORGE-2098) Being able to create a new JPA converter
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-2098?page=com.atlassian.jira.plugin... ]
Antonio Goncalves reassigned FORGE-2098:
----------------------------------------
Assignee: Antonio Goncalves
> Being able to create a new JPA converter
> ----------------------------------------
>
> Key: FORGE-2098
> URL: https://issues.jboss.org/browse/FORGE-2098
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.12.1.Final
> Reporter: Antonio Goncalves
> Assignee: Antonio Goncalves
> Fix For: 2.x Future
>
>
> It would be good to be able to create a new JPA converter with just the following command :
> {code}
> jpa-new-converter --name CreditCardConverter --fromAttribute CreditCard --toColumn String
> {code}
> This will generate the following code :
> {code}
> @Converter(autoApply = true)
> public class CreditCardConverter implements AttributeConverter<CreditCard, String> {
> @Override
> public String convertToDatabaseColumn(CreditCard entityAttribute) {
> return null;
> }
> @Override
> public CreditCard convertToEntityAttribute(String databaseColumn) {
> return null;
> }
> }
> {code}
> (!) This command is only available in JPA 2.1
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months
[JBoss JIRA] (FORGE-1801) Being able to add a custom constraint annotation to a property
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1801?page=com.atlassian.jira.plugin... ]
Antonio Goncalves reassigned FORGE-1801:
----------------------------------------
Assignee: (was: Antonio Goncalves)
> Being able to add a custom constraint annotation to a property
> --------------------------------------------------------------
>
> Key: FORGE-1801
> URL: https://issues.jboss.org/browse/FORGE-1801
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.5.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> With [FORGE-1616] I can now create my own constraint. For example, this is the way I create an ISBN constraint :
> {code}
> constraint-new-annotation --named ISBN
> {code}
> The constraint is created, by default, under the {{constraint}} package. Now the problem, is that I can't apply it to a property because the constraint is not known. If I add a constraint, and press TAB for completion, ISBN does not appear :
> {code}
> [Book.java]$ constraint-add --onProperty isbn --constraint TAB
> Valid Null NotNull AssertTrue AssertFalse Min Max DecimalMin DecimalMax Size Digits Past Future Pattern
> {code}
> Even if I try to add the location of the constraint, it does not work :
> {code}
> [Book.java]$ constraint-add --onProperty isbn --constraint ../constraints/ISBN
> [0] - Valid
> [1] - Null
> [2] - NotNull
> [3] - AssertTrue
> [4] - AssertFalse
> [5] - Min
> [6] - Max
> [7] - DecimalMin
> [8] - DecimalMax
> [9] - Size
> [10] - Digits
> [11] - Past
> [12] - Future
> [13] - Pattern
> ***ERROR*** Constraint must be specified.
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months
[JBoss JIRA] (FORGE-1801) Being able to add a custom constraint annotation to a property
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-1801?page=com.atlassian.jira.plugin... ]
Antonio Goncalves reassigned FORGE-1801:
----------------------------------------
Assignee: Antonio Goncalves
> Being able to add a custom constraint annotation to a property
> --------------------------------------------------------------
>
> Key: FORGE-1801
> URL: https://issues.jboss.org/browse/FORGE-1801
> Project: Forge
> Issue Type: Sub-task
> Components: Java EE
> Affects Versions: 2.5.0.Final
> Reporter: Antonio Goncalves
> Assignee: Antonio Goncalves
> Fix For: 2.x Future
>
>
> With [FORGE-1616] I can now create my own constraint. For example, this is the way I create an ISBN constraint :
> {code}
> constraint-new-annotation --named ISBN
> {code}
> The constraint is created, by default, under the {{constraint}} package. Now the problem, is that I can't apply it to a property because the constraint is not known. If I add a constraint, and press TAB for completion, ISBN does not appear :
> {code}
> [Book.java]$ constraint-add --onProperty isbn --constraint TAB
> Valid Null NotNull AssertTrue AssertFalse Min Max DecimalMin DecimalMax Size Digits Past Future Pattern
> {code}
> Even if I try to add the location of the constraint, it does not work :
> {code}
> [Book.java]$ constraint-add --onProperty isbn --constraint ../constraints/ISBN
> [0] - Valid
> [1] - Null
> [2] - NotNull
> [3] - AssertTrue
> [4] - AssertFalse
> [5] - Min
> [6] - Max
> [7] - DecimalMin
> [8] - DecimalMax
> [9] - Size
> [10] - Digits
> [11] - Past
> [12] - Future
> [13] - Pattern
> ***ERROR*** Constraint must be specified.
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months
[JBoss JIRA] (FORGE-2358) Update the Java EE dependencies
by Antonio Goncalves (JIRA)
Antonio Goncalves created FORGE-2358:
----------------------------------------
Summary: Update the Java EE dependencies
Key: FORGE-2358
URL: https://issues.jboss.org/browse/FORGE-2358
Project: Forge
Issue Type: Feature Request
Components: Java EE
Affects Versions: 2.16.1.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
When setting up various Java EE technologies, the {{pom.xml}} ends up with several dependencies. Some of them could be updated :
|| groupId || artifactId || current version || should be updated to ||
| org.jboss.spec | jboss-javaee-6.0 | 3.0.2.Final | 3.0.3.Final |
| javax.websocket | javax.websocket-api | 1.0 | 1.1 |
| org.hibernate.javax.persistence | hibernate-jpa-2.1-api | 1.0.0.Draft-16 | 1.0.0.Final |
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months
[JBoss JIRA] (FORGE-2225) Being able to create a new CDI producer method
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/FORGE-2225?page=com.atlassian.jira.plugin... ]
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-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}
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 --returnType 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 --returnType 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 create a new CDI producer method
> ----------------------------------------------
>
> 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-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}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months
[JBoss JIRA] (FORGE-2357) Invalid endpoint name in the rest-new-endpoint command
by George Gastaldi (JIRA)
[ https://issues.jboss.org/browse/FORGE-2357?page=com.atlassian.jira.plugin... ]
George Gastaldi closed FORGE-2357.
----------------------------------
Assignee: George Gastaldi
Fix Version/s: 2.16.2.Final
(was: 2.x Future)
Resolution: Rejected
I merged your PR, but I am rejecting this issue, as it is not an issue at all.
Thanks
> Invalid endpoint name in the rest-new-endpoint command
> ------------------------------------------------------
>
> Key: FORGE-2357
> URL: https://issues.jboss.org/browse/FORGE-2357
> Project: Forge
> Issue Type: Bug
> Components: Java EE
> Affects Versions: 2.16.1.Final
> Reporter: Antonio Goncalves
> Assignee: George Gastaldi
> Fix For: 2.16.2.Final
>
>
> When you type the following command :
> {code}
> rest-new-endpoint --named MyEndpoint
> {code}
> The value of the {{@Path}} is {{my}} instead of {{myEndpoint}}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
10 years, 10 months