blob: afd22fb9b4eb8e77cbfe967d287d92d54ef8e1c3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<HTML>
<HEAD>
<meta name="generator" content="JDiff v1.1.1">
<!-- Generated by the JDiff Javadoc doclet -->
<!-- (http://www.jdiff.org) -->
<meta name="description" content="JDiff is a Javadoc doclet which generates an HTML report of all the packages, classes, constructors, methods, and fields which have been removed, added or changed in any way, including their documentation, when two APIs are compared.">
<meta name="keywords" content="diff, jdiff, javadiff, java diff, java difference, API difference, difference between two APIs, API diff, Javadoc, doclet">
<LINK REL="stylesheet" TYPE="text/css" HREF="../stylesheet-jdiff.css" TITLE="Style">
<TITLE>
com.google.inject.assistedinject Documentation Differences
</TITLE>
</HEAD>
<BODY>
<!-- Start of nav bar -->
<TABLE summary="Navigation bar" BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<TABLE summary="Navigation bar" BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/package-summary.html" target="_top"><FONT CLASS="NavBarFont1"><B><tt>3.0</tt></B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="changes-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> &nbsp;<FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1"> &nbsp;<FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="docdiffs_index.html"><FONT CLASS="NavBarFont1"><B>Text Changes</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="jdiff_statistics.html"><FONT CLASS="NavBarFont1"><B>Statistics</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="jdiff_help.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Generated by<br><a href="http://www.jdiff.org" class="staysblack" target="_top">JDiff</a></b></EM></TD>
</TR>
<TR>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="docdiffs_com.google.inject.html"><B>PREV PACKAGE</B></A> &nbsp;
&nbsp;<A HREF="docdiffs_com.google.inject.multibindings.html"><B>NEXT PACKAGE</B></A>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="../changes.html" TARGET="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="docdiffs_com.google.inject.assistedinject.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell2">&nbsp;</TD>
</TR>
</TABLE>
<HR>
<!-- End of nav bar -->
<h2>
com.google.inject.assistedinject Documentation Differences
</h2>
<blockquote>
This file contains all the changes in documentation in the package <code>com.google.inject.assistedinject</code> as colored differences.
Deletions are shown <strike>like this</strike>, and
additions are shown <span style="background: #FFFF00">like this</span>.
</blockquote>
<blockquote>
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The <i>new</i> HTML tags are shown in the differences.
If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here.
Similarly, documentation which was inherited from another class or interface is not shown here.
</blockquote>
<blockquote>
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a &lt;code&gt; tag will cause all subsequent paragraphs to be displayed differently.
</blockquote>
<hr>
<A NAME="com.google.inject.assistedinject.AssistedInject!class"></A><a href="com.google.inject.assistedinject.AssistedInject.html" class="hiddenlink">Class <b>AssistedInject</b></a><br><br><blockquote><p><strike>Constructors</strike><span style="background: #FFFF00">
When used in tandem with <A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/AssistedInject/FactoryModuleBuilder.html"><TT>FactoryModuleBuilder</TT></A>, constructors</span> annotated with <span style="background: #FFFF00">
</span>{@code @AssistedInject} indicate that <strike>they</strike><span style="background: #FFFF00">multiple constructors</span> can be <strike>instantiated</strike><span style="background: #FFFF00">injected,</span> <strike>by
the</strike><span style="background: #FFFF00">each with</span> <span style="background: #FFFF00">different
parameters. AssistedInject annotations should not be mixed with {@literal @}<A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/AssistedInject/Inject.html"></span><TT><strike>FactoryProvider</strike><span style="background: #FFFF00">Inject</span></TT></A><span style="background: #FFFF00">
annotations</span>. <strike>Each constructor</strike><span style="background: #FFFF00">The assisted</span> <span style="background: #FFFF00">parameters </span>must exactly match one corresponding factory <strike>method
within</strike><span style="background: #FFFF00">method within
</span> the factory interface<strike>.
</strike><span style="background: #FFFF00">,</span> <strike>
</strike><span style="background: #FFFF00">but</span> <strike>Constructor</strike><span style="background: #FFFF00">the</span> parameters <strike>must be either supplied by</strike><span style="background: #FFFF00">do not need to be</span> <span style="background: #FFFF00">in </span>the <strike>factory</strike><span style="background: #FFFF00">same</span> <strike>interface</strike><span style="background: #FFFF00">order.</span> <strike>and marked with
</strike><span style="background: #FFFF00">Constructors
annotated with</span> <strike>@Assisted,</strike><span style="background: #FFFF00">AssistedInject</span> <strike>or</strike><b><span style="background: #FFFF00">are</b></span> <strike>they must be</strike><span style="background: #FFFF00">created by Guice</span> <strike>injectable</strike><span style="background: #FFFF00">and receive all the benefits
(such as AOP)</span>.
<strike>@deprecated</strike><p><span style="background: #FFFF00">
<strong>Obsolete Usage:</strong> When used in</span> <span style="background: #FFFF00">tandem with </span><A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/AssistedInject/FactoryProvider.html"><TT>FactoryProvider</TT></A><strike> now</strike><span style="background: #FFFF00">,</span> <strike>works better</strike><span style="background: #FFFF00">constructors
annotated</span> with <strike>the standard </strike>{@<strike>literal</strike><span style="background: #FFFF00">code</span> @<strike>Inject</strike><span style="background: #FFFF00">AssistedInject</span>}<strike>
</strike> <span style="background: #FFFF00">trigger</span> <span style="background: #FFFF00">a</span> <span style="background: #FFFF00">"backwards</span> <span style="background: #FFFF00">compatibility</span> <strike>annotation</strike><span style="background: #FFFF00">mode"</span>. <strike>When using that</strike><span style="background: #FFFF00">The assisted
parameters</span> <strike>annotation,</strike><span style="background: #FFFF00">must</span> <strike>parameters</strike><span style="background: #FFFF00">exactly</span> <strike>are</strike><span style="background: #FFFF00">match one</span> <strike>matched by name</strike><span style="background: #FFFF00">corresponding factory method</span> <strike>and</strike><span style="background: #FFFF00">within the factory interface</span> <strike>type rather than
</strike><span style="background: #FFFF00">and
all must</span> <span style="background: #FFFF00">be</span> <span style="background: #FFFF00">in</span> <span style="background: #FFFF00">the</span> <span style="background: #FFFF00">same</span> <strike>by</strike><span style="background: #FFFF00">order</span> <strike>position</strike><span style="background: #FFFF00">as listed in the factory</span>. In <strike>addition</strike><span style="background: #FFFF00">this backwards compatable mode</span>,<span style="background: #FFFF00">
</span> <strike>values</strike><span style="background: #FFFF00">constructors</span> <strike>that</strike><span style="background: #FFFF00">annotated with AssistedInject <b>are not</b> created</span> <strike>use</strike><span style="background: #FFFF00">by Guice and thus receive
none</span> <span style="background: #FFFF00">of </span>the <strike>standard</strike><span style="background: #FFFF00">benefits.
</span> <strike>{@literal</strike><span style="background: #FFFF00">
</span> <strike>@Inject}</strike><p><span style="background: #FFFF00">
Constructor</span> <strike>constructor
</strike><span style="background: #FFFF00">parameters</span> <span style="background: #FFFF00">must</span> <span style="background: #FFFF00">be</span> <span style="background: #FFFF00">either</span> <span style="background: #FFFF00">supplied</span> <strike>annotation are eligible for</strike><span style="background: #FFFF00">by the factory interface</span> <strike>method</strike><span style="background: #FFFF00">and marked with
<code>@Assisted</code>, or they must</span> <strike>interception</strike><span style="background: #FFFF00">be injectable</span>.<strike>
</strike><span style="background: #FFFF00">
</span> @author jmourits@google.com (Jerome Mourits)
@author jessewilson@google.com (Jesse Wilson)</blockquote>
<hr align="left" width="100%">
<A NAME="com.google.inject.assistedinject.FactoryProvider!class"></A><a href="com.google.inject.assistedinject.FactoryProvider.html" class="hiddenlink">Class <b>FactoryProvider</b></a><br><br><blockquote><strong><span style="background: #FFFF00">Obsolete.</strong> Prefer <A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/FactoryModuleBuilder.html"><TT>FactoryModuleBuilder</TT></A> for its more concise API and
additional capability.
<p></span>Provides a factory that combines the caller's arguments with injector-supplied values to
construct objects.
<h3>Defining a factory</h3>
Create an interface whose methods return the constructed type, or any of its supertypes. The
method's parameters are the arguments required to build the constructed type.
<pre>public interface PaymentFactory {
Payment create(Date startDate, Money amount);
}</pre>
You can name your factory methods whatever you like, such as <i>create</i>, <i>createPayment</i>
or <i>newPayment</i>.
<h3>Creating a type that accepts factory parameters</h3>
{@code constructedType} is a concrete class with an {@literal @}<A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/Inject.html"><TT>Inject</TT></A>-annotated
constructor. In addition to injector-supplied parameters, the constructor should have
parameters that match each of the factory method's parameters. Each factory-supplied parameter
requires an {@literal @}<A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/Assisted.html"><TT>Assisted</TT></A> annotation. This serves to document that the parameter
is not bound by your application's modules.
<pre>public class RealPayment implements Payment {
{@literal @}Inject
public RealPayment(
CreditService creditService,
AuthService authService,
<strong>{@literal @}Assisted Date startDate</strong>,
<strong>{@literal @}Assisted Money amount</strong>) {
...
}
}</pre>
Any parameter that permits a null value should also be annotated {@code @Nullable}.
<h3>Configuring factories</h3>
In your <A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/com/google/inject/Module.html"><TT>module</TT></A>, bind the factory interface to the returned
factory:
<pre>bind(PaymentFactory.class).toProvider(
FactoryProvider.newFactory(PaymentFactory.class, RealPayment.class));</pre>
As a side-effect of this binding, Guice will inject the factory to initialize it for use. The
factory cannot be used until the injector has been initialized.
<h3>Using the factory</h3>
Inject your factory into your application classes. When you use the factory, your arguments
will be combined with values from the injector to construct an instance.
<pre>public class PaymentAction {
{@literal @}Inject private PaymentFactory paymentFactory;
public void doPayment(Money amount) {
Payment payment = paymentFactory.create(new Date(), amount);
payment.apply();
}
}</pre>
<h3>Making parameter types distinct</h3>
The types of the factory method's parameters must be distinct. To use multiple parameters of
the same type, use a named {@literal @}<A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/Assisted.html"><TT>Assisted</TT></A> annotation to disambiguate the
parameters. The names must be applied to the factory method's parameters:
<pre>public interface PaymentFactory {
Payment create(
<strong>{@literal @}Assisted("startDate")</strong> Date startDate,
<strong>{@literal @}Assisted("dueDate")</strong> Date dueDate,
Money amount);
} </pre>
...and to the concrete type's constructor parameters:
<pre>public class RealPayment implements Payment {
{@literal @}Inject
public RealPayment(
CreditService creditService,
AuthService authService,
<strong>{@literal @}Assisted("startDate")</strong> Date startDate,
<strong>{@literal @}Assisted("dueDate")</strong> Date dueDate,
<strong>{@literal @}Assisted</strong> Money amount) {
...
}
}</pre>
<h3>Values are created by Guice</h3>
Returned factories use child injectors to create values. The values are eligible for method
interception. In addition, {@literal @}{@literal Inject} members will be injected before they are
returned.
<h3>Backwards compatibility using {@literal @}AssistedInject</h3>
Instead of the {@literal @}Inject annotation, you may annotate the constructed classes with
{@literal @}<A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/AssistedInject.html"><TT>AssistedInject</TT></A>. This triggers a limited backwards-compatability mode.
<p>Instead of matching factory method arguments to constructor parameters using their names, the
<strong>parameters are matched by their order</strong>. The first factory method argument is
used for the first {@literal @}Assisted constructor parameter, etc.. Annotation names have no
effect.
<p>Returned values are <strong>not created by Guice</strong>. These types are not eligible for
method interception. They do receive post-construction member injection.
@param <F> The factory interface
@author jmourits@google.com (Jerome Mourits)
@author jessewilson@google.com (Jesse Wilson)
@author dtm@google.com (Daniel Martin)<span style="background: #FFFF00">
@deprecated use <A HREF="http://google-guice.googlecode.com/svn/trunk/latest-api-diffs/3.0/javadoc/com/google/inject/assistedinject/FactoryProvider/FactoryModuleBuilder.html"><TT>FactoryModuleBuilder</TT></A> instead.</span></blockquote>
<hr align="left" width="100%">
</BODY>
</HTML>