summaryrefslogtreecommitdiff
path: root/javadoc/javax/inject/Inject.html
diff options
context:
space:
mode:
Diffstat (limited to 'javadoc/javax/inject/Inject.html')
-rw-r--r--javadoc/javax/inject/Inject.html101
1 files changed, 35 insertions, 66 deletions
diff --git a/javadoc/javax/inject/Inject.html b/javadoc/javax/inject/Inject.html
index 17b52f8..64b5ecb 100644
--- a/javadoc/javax/inject/Inject.html
+++ b/javadoc/javax/inject/Inject.html
@@ -2,7 +2,7 @@
<!--NewPage-->
<HTML>
<HEAD>
-<!-- Generated by javadoc (build 1.5.0_13) on Tue Apr 28 17:34:50 PDT 2009 -->
+<!-- Generated by javadoc (build 1.5.0_16) on Tue Jun 23 17:21:19 CDT 2009 -->
<TITLE>
Inject
</TITLE>
@@ -71,9 +71,9 @@ function windowTitle()
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY:&nbsp;REQUIRED&nbsp;|&nbsp;<A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD>
+ SUMMARY:&nbsp;REQUIRED&nbsp;|&nbsp;OPTIONAL</FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
-DETAIL:&nbsp;<A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD>
+DETAIL:&nbsp;ELEMENT</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
@@ -142,17 +142,21 @@ Identifies injectable constructors, methods, and fields. Applies to static
<li>are annotated with <code>@Inject</code>.</li>
<li>are not abstract.</li>
<li>do not declare type parameters of their own.</li>
- <li>return <code>void</code>.</li>
+ <li>may return a result</li>
<li>may have any otherwise valid name.</li>
<li>accept zero or more dependencies as arguments.</li></ul>
<p><tt><blockquote style="padding-left: 2em; text-indent: -2em;">@Inject
<i>MethodModifiers<sub>opt</sub></i>
- void
+ <i>ResultType</i>
<i>Identifier</i>(<i>FormalParameterList<sub>opt</sub></i>)
<i>Throws<sub>opt</sub></i>
<i>MethodBody</i></blockquote></tt>
+ <p>The injector ignores the result of an injected method, but
+ non-<code>void</code> return types are allowed to support use of the method in
+ other contexts (builder-style method chaining, for example).
+
<p>For example:
<pre>
@@ -173,10 +177,31 @@ Identifies injectable constructors, methods, and fields. Applies to static
that overrides a method annotated with <code>@Inject</code> will not be
injected.
- <p>Injection of members annotated with <code>@Inject</code> is required by
- default. This behavior can be overridden by setting <A HREF="../../javax/inject/Inject.html#optional()"><CODE>optional</CODE></A> equal to <code>true</code>.
+ <p>Injection of members annotated with <code>@Inject</code> is required.
+
+ <h3>Qualifiers</h3>
+
+ <p>A <A HREF="../../javax/inject/Qualifier.html" title="annotation in javax.inject">qualifier</A> may annotate an injectable field
+ or parameter and, combined with the type, identify the implementation to
+ inject. Qualifiers are optional and when used with <code>@Inject</code>, no more
+ than one qualifier should annotate a single field or parameter. The
+ qualifiers are bold in the following example:
+
+ <pre>
+ public class Car {
+ &#064;Inject private <b>@Leather</b> Provider&lt;Seat> seatProvider;
+
+ &#064;Inject void install(<b>@Tinted</b> Windshield windshield,
+ <b>@Big</b> Trunk trunk) { ... }
+ }</pre>
+
+ <p>If one injectable method overrides another, the overriding method's
+ parameters do not automatically inherit qualifiers from the overridden
+ method's parameters.
- <p>Detecting and resolving circular dependencies is left as an exercize for
+ <h3>Circular Dependencies</h3>
+
+ <p>Detecting and resolving circular dependencies is left as an exercise for
the injector implementation. Circular dependencies between two constructors
is an obvious problem, but you can also have a circular dependency between
injectable fields or methods:
@@ -208,66 +233,10 @@ Identifies injectable constructors, methods, and fields. Applies to static
<DL>
<DT><B>See Also:</B><DD><A HREF="../../javax/inject/Qualifier.html" title="annotation in javax.inject"><CODE>@Qualifier</CODE></A>,
<A HREF="../../javax/inject/Provider.html" title="interface in javax.inject"><CODE>Provider</CODE></A></DL>
-<HR>
<P>
-<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
-<A NAME="annotation_type_optional_element_summary"><!-- --></A>
-<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
-<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
-<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
-<B>Optional Element Summary</B></FONT></TH>
-</TR>
-<TR BGCOLOR="white" CLASS="TableRowColor">
-<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
-<CODE>&nbsp;boolean</CODE></FONT></TD>
-<TD><CODE><B><A HREF="../../javax/inject/Inject.html#optional()">optional</A></B></CODE>
-
-<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Whether or not injection is optional.</TD>
-</TR>
-</TABLE>
-&nbsp;
<P>
-<A NAME="optional()"><!-- --></A><H3>
-optional</H3>
-<PRE>
-public abstract boolean <B>optional</B></PRE>
-<DL>
-<DD>Whether or not injection is optional. If <code>true</code>, the injector's
- behavior varies depending on the type of injection point:
-
- <p><ul>
- <li><b>Constructors:</b> <i>Not allowed</i></li>
- <li><b>Fields:</b> If a dependency matching the field can't
- be found, the injector will not set the field.</li>
- <li><b>Methods:</b> If a dependency matching a method parameter can't
- be found, the injector will skip invoking the method entirely, even
- if other arguments could be provided.</li>
- </ul>
-
- <p>If an applicable dependency has been configured but the injector
- encounters an error while resolving the dependency (a transitive
- dependency could be missing, for example), the injector should generate
- an error, not skip the injection. For example:
-
- <pre>
- &#064;Inject(optional=true) Gps gps;</pre>
-
- <p>If a Gps isn't available at all, the injector will simply not set the
- <code>gps</code> field. If a Gps is available but an algorithm it depends
- upon can't be found, the injector will generate an error.
-<P>
-<DD><DL>
-</DL>
-</DD>
-<DD><DL>
-</DL>
-<DL>
-<DT><B>Default:</B><DD>false</DD>
-</DL>
-</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
@@ -318,9 +287,9 @@ public abstract boolean <B>optional</B></PRE>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY:&nbsp;REQUIRED&nbsp;|&nbsp;<A HREF="#annotation_type_optional_element_summary">OPTIONAL</A></FONT></TD>
+ SUMMARY:&nbsp;REQUIRED&nbsp;|&nbsp;OPTIONAL</FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
-DETAIL:&nbsp;<A HREF="#annotation_type_element_detail">ELEMENT</A></FONT></TD>
+DETAIL:&nbsp;ELEMENT</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>