[JBoss JIRA] (CDI-472) Support @WithAnnotations as type annotation of lifecycle events
by Antonin Stefanutti (JIRA)
Antonin Stefanutti created CDI-472:
--------------------------------------
Summary: Support @WithAnnotations as type annotation of lifecycle events
Key: CDI-472
URL: https://issues.jboss.org/browse/CDI-472
Project: CDI Specification Issues
Issue Type: Feature Request
Reporter: Antonin Stefanutti
As Java 8 introduces type annotations, generalizing the benefit of {{@WithAnnotations}} by using it as type annotation could improve a lot of recurring patterns that are usually implemented as a combination of {{ProcessAnnotatedType}} and other lifecycle events.
For example, instead of having to write that in a CDI extension:
{code}
Set<AnnotatedType<?>> camelBeans = new HashMap<>();
void camelAnnotations(@Observes @WithAnnotations({BeanInject.class, Consume.class, EndpointInject.class, Produce.class, PropertyInject.class}) ProcessAnnotatedType<?> pat) {
camelBeans.add(pat.getAnnotatedType());
}
<T> void camelBeansPostProcessor(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
if (camelBeans.contains(pit.getAnnotatedType()))
pit.setInjectionTarget(new CdiCamelInjectionTarget<>(pit.getInjectionTarget(), manager));
}
{code}
One could write directly:
{code}
<@WithAnnotations({BeanInject.class, Consume.class, EndpointInject.class, Produce.class, PropertyInject.class}) T> void camelBeansPostProcessor(@Observes ProcessInjectionTarget<T> pit, BeanManager manager) {
pit.setInjectionTarget(new CdiCamelInjectionTarget<>(pit.getInjectionTarget(), manager));
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (CDI-460) Support repeating annotations in CDI SPI
by Antonin Stefanutti (JIRA)
[ https://issues.jboss.org/browse/CDI-460?page=com.atlassian.jira.plugin.sy... ]
Antonin Stefanutti commented on CDI-460:
----------------------------------------
[~arnelim] I agree with you. I've just created [CDI-471] to track that second issue, that is the support at the level of the typesafe resolution of repeating qualifiers and container / list annotations as well.
> Support repeating annotations in CDI SPI
> ----------------------------------------
>
> Key: CDI-460
> URL: https://issues.jboss.org/browse/CDI-460
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Affects Versions: 2.0 (discussion)
> Reporter: Antonin Stefanutti
>
> In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
> {{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
> {{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
> {{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
> Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
> Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Tough, that's important to have that support explicitly stated and specified in CDI.
> Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
> That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
> While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (CDI-460) Support repeating annotations in CDI SPI
by Antonin Stefanutti (JIRA)
[ https://issues.jboss.org/browse/CDI-460?page=com.atlassian.jira.plugin.sy... ]
Antonin Stefanutti updated CDI-460:
-----------------------------------
Summary: Support repeating annotations in CDI SPI (was: Support repeating qualifiers in CDI SPI)
> Support repeating annotations in CDI SPI
> ----------------------------------------
>
> Key: CDI-460
> URL: https://issues.jboss.org/browse/CDI-460
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Affects Versions: 2.0 (discussion)
> Reporter: Antonin Stefanutti
>
> In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
> {{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
> {{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
> {{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
> Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
> Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Tough, that's important to have that support explicitly stated and specified in CDI.
> Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
> That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
> While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (CDI-471) Support repeating qualifiers in typesafe resolution mechanism
by Antonin Stefanutti (JIRA)
Antonin Stefanutti created CDI-471:
--------------------------------------
Summary: Support repeating qualifiers in typesafe resolution mechanism
Key: CDI-471
URL: https://issues.jboss.org/browse/CDI-471
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Resolution
Reporter: Antonin Stefanutti
As Java 8 provides improved support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it would be valuable to percolate that support into the CDI typesafe resolution mechanism.
For example, one could write:
{code}
@Qualifier
@Repeatable(ContextNames.class)
public interface @ContextName {
String value;
}
public @interface ContextNames {
ContextName[] value();
}
{code}
And then:
{code}
@ContextName("ctx1")
class CamelContext1 {
}
@ContextName("ctx2")
class CamelContext2 {
}
@Uri("")
@Produces
@ContextName("ctx1")
@ContextName("ctx2")
static ProducerTemplate producerTemplate(InjectionPoint ip, @Any Instance<CamelContext> instance) {
}
{code}
That enables to use annotations both as a CDI qualifiers and a metadata providers while still be relying on standard typesafe resolution mechanism during the deployment phase to detect unsatisfied or ambiguous dependencies.
Support of the annotation container / list for backward compatibility could be provided as well.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
Workshops leaders and members raise you hand
by Antoine Sabot-Durand
Hi all,
As you may have sawn, I created the docs and Jira Epic tickets associated with major workshops.
Those Epic tickets are here :
https://issues.jboss.org/browse/CDI-467?filter=12322370
Now it’s time to get started.
If you have a rather good knowledge of CDI and have a vision of one of these workshop, you can volunteer to lead one. The role consist to write a draft on the subject. This draft will be a starting point for discussion. The workshop leader may also organise meetings if he feels it necessary. It shouldn’t take you a lot of time and this role can be taken by two people if you don’t like being alone. This role is not definitive and if in a near future you lack time to pursue it, just tell and someone else will step in.
Workshop members are people interested on the subject and ready to contribute with ideas or help for the leader. All community member can be part of these workshop. But to have a better idea of our work force, people who want to be part of one or more workshop should let us know : we won’t deliver the same content if we are 5 or 15...
Anyway, Pete and/or I will be part of all workshops and lead those that didn’t find another leader.
Remember that we imagined this organisation to ease community participation and casual contribution. So don’t be shy, it’s time to tell us your commitment to CDI ;).
Antoine
9 years, 9 months
[JBoss JIRA] (CDI-470) Clarify @Vetoed on recursive package
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-470?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-470:
----------------------------------
Yes, something like this sounds reasonable. Right now, you can only use exclude filters in beans.xml or a portable extension and {{ProcessAnnotatedType.veto()}}. But it's not that practical. What I'm trying to say is that it's not a perfect match to use an annotation on a package to affect the subpackages.
> Clarify @Vetoed on recursive package
> ------------------------------------
>
> Key: CDI-470
> URL: https://issues.jboss.org/browse/CDI-470
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Beans
> Affects Versions: 1.2.Final
> Reporter: Antonio Goncalves
>
> It's not clear in the specification is {{@Vetoed}} only apply to the current package or subpackages as well. This has been addressed on [CDI-299] but not solved. Either, we make it clearer in the spec that it only addresses the current package and not subpackages, or we could have a boolean, such as {{recursive}} :
> {code:title=package-info.java}
> @Vetoed(recursive=true)
> package my.parent.package;
> import javax.enterprise.inject.Vetoed;
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (CDI-470) Clarify @Vetoed on recursive package
by Romain Manni-Bucau (JIRA)
[ https://issues.jboss.org/browse/CDI-470?page=com.atlassian.jira.plugin.sy... ]
Romain Manni-Bucau commented on CDI-470:
----------------------------------------
Hmm
for me it was logical that it was the opposite otherwise it is clearly too impacting when a project is well organized at package level.
scan block in beans.xml has .**, annotation should get it as well no?
> Clarify @Vetoed on recursive package
> ------------------------------------
>
> Key: CDI-470
> URL: https://issues.jboss.org/browse/CDI-470
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Beans
> Affects Versions: 1.2.Final
> Reporter: Antonio Goncalves
>
> It's not clear in the specification is {{@Vetoed}} only apply to the current package or subpackages as well. This has been addressed on [CDI-299] but not solved. Either, we make it clearer in the spec that it only addresses the current package and not subpackages, or we could have a boolean, such as {{recursive}} :
> {code:title=package-info.java}
> @Vetoed(recursive=true)
> package my.parent.package;
> import javax.enterprise.inject.Vetoed;
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (CDI-470) Clarify @Vetoed on recursive package
by Antonio Goncalves (JIRA)
[ https://issues.jboss.org/browse/CDI-470?page=com.atlassian.jira.plugin.sy... ]
Antonio Goncalves commented on CDI-470:
---------------------------------------
Hum... not that clear to me, but well.
Shall it stay like that ? I tend to add a package-level {{@Veto}} on my entities ({{org.mystuff.model}})... but in big projects my model is usually spllitted into sub packages ({{org.mystuff.model.customer}}, {{org.mystuff.model.order}}, ...). Recursive veto would be interesting.
Any thoughts ?
> Clarify @Vetoed on recursive package
> ------------------------------------
>
> Key: CDI-470
> URL: https://issues.jboss.org/browse/CDI-470
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Beans
> Affects Versions: 1.2.Final
> Reporter: Antonio Goncalves
>
> It's not clear in the specification is {{@Vetoed}} only apply to the current package or subpackages as well. This has been addressed on [CDI-299] but not solved. Either, we make it clearer in the spec that it only addresses the current package and not subpackages, or we could have a boolean, such as {{recursive}} :
> {code:title=package-info.java}
> @Vetoed(recursive=true)
> package my.parent.package;
> import javax.enterprise.inject.Vetoed;
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months
[JBoss JIRA] (CDI-469) Allow nonbinding producer methods to have scopes
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-469?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-469:
----------------------------------
[~meetoblivion] I'm sorry but I don't follow you. Could you be more specific about what "nonbinding producer method" means? Simple example would be helpful as well ;-)
> Allow nonbinding producer methods to have scopes
> ------------------------------------------------
>
> Key: CDI-469
> URL: https://issues.jboss.org/browse/CDI-469
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans, Contexts
> Affects Versions: 1.2.Final
> Reporter: John Ament
>
> Currently, you cannot have a nonbinding producer method, e.g. one where the annotation is read at runtime, with a scope. This means that repeated injections always happen. It would be better if you could scope the nonbinding producer methods, so that the results were bound, e.g. to a request scope, so that look ups can be done once.
> The current way to avoid this is to use a holder object with the proper scope.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
9 years, 9 months