Author: gavin.king(a)jboss.com
Date: 2009-11-06 04:06:44 -0500 (Fri, 06 Nov 2009)
New Revision: 4713
Modified:
doc/trunk/reference/en-US/intro.xml
Log:
minor revs
Modified: doc/trunk/reference/en-US/intro.xml
===================================================================
--- doc/trunk/reference/en-US/intro.xml 2009-11-06 05:44:56 UTC (rev 4712)
+++ doc/trunk/reference/en-US/intro.xml 2009-11-06 09:06:44 UTC (rev 4713)
@@ -47,7 +47,7 @@
The JavaBeans and EJBs you've been writing every day, up until now, have not
been able to take advantage
of the new services defined by the CDI specification. But you'll be able to
use every one of them with
CDI—allowing the container to create and destroy instances of your
beans and associate them with a
- designed context, injecting them into other beans, using them in EL expressions,
specializing them with
+ designated context, injecting them into other beans, using them in EL
expressions, specializing them with
qualifier annotations, even adding interceptors and decorators to
them—without modifying your
existing code. At most, you'll need to add some annotations.
</para>
@@ -124,10 +124,10 @@
</para>
<para>
- We may obtain an instance of <literal>TextTranslator</literal> by
injecting it into a constructor, bean
- "setter" method, producer method, observer method or field of a
JavaBean or EJB session bean, or a field
- of a servlet. The injection is based on the type of the injection point, not the
name of the field, method
- or parameter.
+ We may obtain an instance of <literal>TextTranslator</literal> by
injecting it into a constructor, method
+ or field of a bean, or a field or method of a Java EE component class such as a
servlet. The container
+ chooses the object to be injected based on the type of the injection point, not
the name of the field,
+ method or parameter.
</para>
<para>
@@ -186,16 +186,16 @@
instance of <literal>Instance</literal>, parameterized with the bean
type:
</para>
- <programlisting role="JAVA"><![CDATA[@Inject
Instance<TextTranslator> textTranslatorSource;
+ <programlisting role="JAVA"><![CDATA[@Inject
Instance<TextTranslator> textTranslatorInstance;
...
public void translate() {
- textTranslatorSource.get().translate(inputText);
+ textTranslatorInstance().translate(inputText);
}]]></programlisting>
<para>
Notice that it isn't necessary to create a getter or setter method to inject
one bean into another. CDI can
- access the field directly (even if it's private!), which should help
eliminate some wasteful code. The name of
- the field is arbitrary. It's the field's type that determines what is
injected.
+ access an injected field directly (even if it's private!), which sometimes
help eliminate some wasteful code.
+ The name of the field is arbitrary. It's the field's type that
determines what is injected.
</para>
<para>
@@ -204,8 +204,7 @@
<literal>SentenceTranslator</literal> EJB was not
deployed—the container would throw an
<literal>UnsatisfiedDependencyException</literal>. If more than one
implementation of
<literal>Translator</literal> were available, the container would
throw an
- <literal>AmbiguousDependencyException</literal>. The same for the
<literal>TextTranslator</literal> injection
- point.
+ <literal>AmbiguousDependencyException</literal>.
</para>
<para>
@@ -286,7 +285,7 @@
<para>
Note that not all clients of a bean are beans themselves. Other objects such as
servlets or message-driven
- beans—which are by nature not injectable, contextual
objects—may also obtain references to beans by
+ beans—which are by nature not injectable, contextual
objects—may also obtain references to beans by
injection.
</para>
Show replies by date