[weld-commits] Weld SVN: r5072 - doc/trunk/reference/en-US.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Sun Nov 15 21:04:01 EST 2009
Author: gavin.king at jboss.com
Date: 2009-11-15 21:04:01 -0500 (Sun, 15 Nov 2009)
New Revision: 5072
Modified:
doc/trunk/reference/en-US/beans.xml
doc/trunk/reference/en-US/injection.xml
doc/trunk/reference/en-US/scopescontexts.xml
Log:
new tip
Modified: doc/trunk/reference/en-US/beans.xml
===================================================================
--- doc/trunk/reference/en-US/beans.xml 2009-11-16 01:49:47 UTC (rev 5071)
+++ doc/trunk/reference/en-US/beans.xml 2009-11-16 02:04:01 UTC (rev 5072)
@@ -250,11 +250,11 @@
<!--
<tip>
<para>
- If you're expectng more than one bean to satisfy the contract, you can inject an <literal>Instance</literal>,
+ If you're expecting more than one bean to satisfy the contract, you can inject an <literal>Instance</literal>,
object which let's you iterate over all the beans which satisfy the contract. For example, we can iterate
over all our implementations of <literal>PaymentProcessor</literal> using:
</para>
- <programlisting>@Inject void init(@Any Instance<PaymentProcessor> paymentProcessorInstance) {
+ <programlisting role="JAVA">@Inject void init(@Any Instance<PaymentProcessor> paymentProcessorInstance) {
for (PaymentProcessor pp: paymentProcessorInstance) { ... }
}</programlisting>
</tip>
Modified: doc/trunk/reference/en-US/injection.xml
===================================================================
--- doc/trunk/reference/en-US/injection.xml 2009-11-16 01:49:47 UTC (rev 5071)
+++ doc/trunk/reference/en-US/injection.xml 2009-11-16 02:04:01 UTC (rev 5072)
@@ -262,6 +262,25 @@
</para>
</section>
+
+ <section>
+ <title>The built-in qualifiers <literal>@Default</literal> and <literal>@Any</literal></title>
+
+ <para>Whenever a bean or injection point does not explicitly declare a qualifier, the container assumes the
+ qualifier <literal>@Default</literal>. From time to time, you'll need to decare an injection point without
+ specifying a qualifier. There's a qualifier for that too. All beans have the qualifier <literal>@Any</literal>.</para>
+
+ <tip>
+ <para>This is especially useful if you want to iterate over all beans with a certain bean type. For example:</para>
+ <programlisting role="JAVA"><![CDATA[@Inject
+void initServices(@Any Instance<Service> services) {
+ for (Service service: services) {
+ service.init();
+ }
+}]]></programlisting>
+ </tip>
+
+ </section>
<section>
<title>Qualifiers with members</title>
Modified: doc/trunk/reference/en-US/scopescontexts.xml
===================================================================
--- doc/trunk/reference/en-US/scopescontexts.xml 2009-11-16 01:49:47 UTC (rev 5071)
+++ doc/trunk/reference/en-US/scopescontexts.xml 2009-11-16 02:04:01 UTC (rev 5072)
@@ -37,7 +37,7 @@
which just doesn't map naturally to the model used in CDI. Therefore, we recommend against treating entities
as CDI beans. You're certainly going to run into problems if you try to give an entity a scope other than
the default scope <literal>@Dependent</literal>. The client proxy will get in the way if you try to pass
- an injected instance to the JPA |EntityManager|.
+ an injected instance to the JPA <literal>EntityManager</literal>.
</para>
</tip>
More information about the weld-commits
mailing list