diff options
18 files changed, 60 insertions, 66 deletions
diff --git a/latest-api-diffs/missingSinces.txt b/latest-api-diffs/missingSinces.txt index d266f58c..cf682d2e 100644 --- a/latest-api-diffs/missingSinces.txt +++ b/latest-api-diffs/missingSinces.txt @@ -22,7 +22,7 @@ OK: com.google.inject.spi.InterceptorBinding Class OK: com.google.inject.spi.LinkedKeyBinding Interface OK: com.google.inject.spi.ModuleWriter Class OK: com.google.inject.OutOfScopeException Class -OK: com.google.inject.binder.PrivateBinder Interface +OK: com.google.inject.PrivateBinder Interface OK: com.google.inject.spi.PrivateElements Interface OK: com.google.inject.PrivateModule Class OK: com.google.inject.spi.ProviderBinding Interface diff --git a/latest-api-diffs/user_comments_for_v1_to_v2.xml b/latest-api-diffs/user_comments_for_v1_to_v2.xml index a8170512..cb8f88a7 100644 --- a/latest-api-diffs/user_comments_for_v1_to_v2.xml +++ b/latest-api-diffs/user_comments_for_v1_to_v2.xml @@ -628,7 +628,7 @@ </text> </comment> <comment> - <identifier id="com.google.inject.binder.PrivateBinder"/> + <identifier id="com.google.inject.PrivateBinder"/> <text> InsertCommentsHere </text> diff --git a/latest-api-diffs/v2.xml b/latest-api-diffs/v2.xml index bb8edaf2..98d826d1 100644 --- a/latest-api-diffs/v2.xml +++ b/latest-api-diffs/v2.xml @@ -469,7 +469,7 @@ @since 2.0]]> </doc> </method> - <method name="newPrivateBinder" return="com.google.inject.binder.PrivateBinder" + <method name="newPrivateBinder" return="com.google.inject.PrivateBinder" abstract="false" native="false" synchronized="false" static="false" final="false" visibility="public" deprecated="not deprecated"> @@ -2545,7 +2545,7 @@ </doc> </interface> <!-- end interface com.google.inject.binder.LinkedBindingBuilder --> - <!-- start interface com.google.inject.binder.PrivateBinder --> + <!-- start interface com.google.inject.PrivateBinder --> <interface name="PrivateBinder" abstract="true" static="false" final="false" visibility="public" deprecated="not deprecated"> @@ -2581,13 +2581,13 @@ binding annotation.]]> </doc> </method> - <method name="withSource" return="com.google.inject.binder.PrivateBinder" + <method name="withSource" return="com.google.inject.PrivateBinder" abstract="false" native="false" synchronized="false" static="false" final="false" visibility="public" deprecated="not deprecated"> <param name="source" type="java.lang.Object"/> </method> - <method name="skipSources" return="com.google.inject.binder.PrivateBinder" + <method name="skipSources" return="com.google.inject.PrivateBinder" abstract="false" native="false" synchronized="false" static="false" final="false" visibility="public" deprecated="not deprecated"> @@ -2601,7 +2601,7 @@ @since 2.0]]> </doc> </interface> - <!-- end interface com.google.inject.binder.PrivateBinder --> + <!-- end interface com.google.inject.PrivateBinder --> <!-- start interface com.google.inject.binder.ScopedBindingBuilder --> <interface name="ScopedBindingBuilder" abstract="true" static="false" final="false" visibility="public" @@ -4953,12 +4953,12 @@ static="false" final="false" visibility="protected" deprecated="not deprecated"> <param name="privateElements" type="com.google.inject.spi.PrivateElements"/> - <param name="binder" type="com.google.inject.binder.PrivateBinder"/> + <param name="binder" type="com.google.inject.PrivateBinder"/> <doc> <![CDATA[Associates {@code binder} with {@code privateElements}.]]> </doc> </method> - <method name="getPrivateBinder" return="com.google.inject.binder.PrivateBinder" + <method name="getPrivateBinder" return="com.google.inject.PrivateBinder" abstract="false" native="false" synchronized="false" static="false" final="false" visibility="protected" deprecated="not deprecated"> diff --git a/latest-api-diffs/v2/com/google/inject/binder/class-use/PrivateBinder.html b/latest-api-diffs/v2/com/google/inject/binder/class-use/PrivateBinder.html index f159cc7b..2c4fee59 100644 --- a/latest-api-diffs/v2/com/google/inject/binder/class-use/PrivateBinder.html +++ b/latest-api-diffs/v2/com/google/inject/binder/class-use/PrivateBinder.html @@ -4,7 +4,7 @@ <HEAD> <!-- Generated by javadoc (build 1.6.0_07) on Tue Dec 30 23:53:15 PST 2008 --> <TITLE> -Uses of Interface com.google.inject.binder.PrivateBinder (Guice 2 Prerelease) +Uses of Interface com.google.inject.PrivateBinder (Guice 2 Prerelease) </TITLE> <META NAME="date" CONTENT="2008-12-30"> @@ -81,7 +81,7 @@ function windowTitle() <HR> <CENTER> <H2> -<B>Uses of Interface<br>com.google.inject.binder.PrivateBinder</B></H2> +<B>Uses of Interface<br>com.google.inject.PrivateBinder</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> @@ -197,7 +197,7 @@ Uses of <A HREF="../../../../../com/google/inject/binder/PrivateBinder.html" tit <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected void</CODE></FONT></TD> -<TD><CODE><B>ModuleWriter.</B><B><A HREF="../../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, +<TD><CODE><B>ModuleWriter.</B><B><A HREF="../../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, <A HREF="../../../../../com/google/inject/binder/PrivateBinder.html" title="interface in com.google.inject.binder">PrivateBinder</A> binder)</CODE> <BR> diff --git a/latest-api-diffs/v2/com/google/inject/class-use/Binder.html b/latest-api-diffs/v2/com/google/inject/class-use/Binder.html index edf87c30..a21132f3 100644 --- a/latest-api-diffs/v2/com/google/inject/class-use/Binder.html +++ b/latest-api-diffs/v2/com/google/inject/class-use/Binder.html @@ -616,7 +616,7 @@ Uses of <A HREF="../../../../com/google/inject/Binder.html" title="interface in <A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> element)</CODE> <BR> - Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> + Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> diff --git a/latest-api-diffs/v2/com/google/inject/spi/ModuleWriter.html b/latest-api-diffs/v2/com/google/inject/spi/ModuleWriter.html index 6d918fe5..5dc65299 100644 --- a/latest-api-diffs/v2/com/google/inject/spi/ModuleWriter.html +++ b/latest-api-diffs/v2/com/google/inject/spi/ModuleWriter.html @@ -191,7 +191,7 @@ Creates a Module from a collection of component elements. <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected void</CODE></FONT></TD> -<TD><CODE><B><A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, +<TD><CODE><B><A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, <A HREF="../../../../com/google/inject/binder/PrivateBinder.html" title="interface in com.google.inject.binder">PrivateBinder</A> binder)</CODE> <BR> @@ -272,7 +272,7 @@ Creates a Module from a collection of component elements. <A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> element)</CODE> <BR> - Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> + Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> @@ -449,7 +449,7 @@ writePrivateElements</H3> protected void <B>writePrivateElements</B>(<A HREF="../../../../com/google/inject/Binder.html" title="interface in com.google.inject">Binder</A> binder, <A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> element)</PRE> <DL> -<DD>Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two. +<DD>Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two. <P> <DD><DL> </DL> @@ -472,7 +472,7 @@ protected <T> <A HREF="../../../../com/google/inject/binder/ScopedBindingB </DL> <HR> -<A NAME="setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><!-- --></A><H3> +<A NAME="setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><!-- --></A><H3> setPrivateBinder</H3> <PRE> protected void <B>setPrivateBinder</B>(<A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, diff --git a/latest-api-diffs/v2/com/google/inject/spi/class-use/PrivateElements.html b/latest-api-diffs/v2/com/google/inject/spi/class-use/PrivateElements.html index f76d1ca7..0b413f9a 100644 --- a/latest-api-diffs/v2/com/google/inject/spi/class-use/PrivateElements.html +++ b/latest-api-diffs/v2/com/google/inject/spi/class-use/PrivateElements.html @@ -137,7 +137,7 @@ Uses of <A HREF="../../../../../com/google/inject/spi/PrivateElements.html" titl <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected void</CODE></FONT></TD> -<TD><CODE><B>ModuleWriter.</B><B><A HREF="../../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, +<TD><CODE><B>ModuleWriter.</B><B><A HREF="../../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, <A HREF="../../../../../com/google/inject/binder/PrivateBinder.html" title="interface in com.google.inject.binder">PrivateBinder</A> binder)</CODE> <BR> @@ -166,7 +166,7 @@ Uses of <A HREF="../../../../../com/google/inject/spi/PrivateElements.html" titl <A HREF="../../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> element)</CODE> <BR> - Writes the elements of the private environment to a new private binder and <A HREF="../../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> + Writes the elements of the private environment to a new private binder and <A HREF="../../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> </TR> </TABLE> diff --git a/latest-api-diffs/v2/index-all.html b/latest-api-diffs/v2/index-all.html index fc4b4c29..f379f168 100644 --- a/latest-api-diffs/v2/index-all.html +++ b/latest-api-diffs/v2/index-all.html @@ -1199,7 +1199,7 @@ Static variable in class com.google.inject.servlet.<A HREF="./com/google/inject/ Static method in class com.google.inject.util.<A HREF="./com/google/inject/util/Types.html" title="class in com.google.inject.util">Types</A> <DD>Returns a type modelling a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><CODE>Set</CODE></A> whose elements are of type <code>elementType</code>. -<DT><A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><B>setPrivateBinder(PrivateElements, PrivateBinder)</B></A> - +<DT><A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><B>setPrivateBinder(PrivateElements, PrivateBinder)</B></A> - Method in class com.google.inject.spi.<A HREF="./com/google/inject/spi/ModuleWriter.html" title="class in com.google.inject.spi">ModuleWriter</A> <DD>Associates <code>binder</code> with <code>privateElements</code>. <DT><A HREF="./com/google/inject/Scopes.html#SINGLETON"><B>SINGLETON</B></A> - @@ -1538,7 +1538,7 @@ Method in class com.google.inject.spi.<A HREF="./com/google/inject/spi/ModuleWri <DD> <DT><A HREF="./com/google/inject/spi/ModuleWriter.html#writePrivateElements(com.google.inject.Binder, com.google.inject.spi.PrivateElements)"><B>writePrivateElements(Binder, PrivateElements)</B></A> - Method in class com.google.inject.spi.<A HREF="./com/google/inject/spi/ModuleWriter.html" title="class in com.google.inject.spi">ModuleWriter</A> -<DD>Writes the elements of the private environment to a new private binder and <A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two. +<DD>Writes the elements of the private environment to a new private binder and <A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two. <DT><A HREF="./com/google/inject/Key.html#writeReplace()"><B>writeReplace()</B></A> - Method in class com.google.inject.<A HREF="./com/google/inject/Key.html" title="class in com.google.inject">Key</A> <DD> diff --git a/latest-javadoc/com/google/inject/spi/ModuleWriter.html b/latest-javadoc/com/google/inject/spi/ModuleWriter.html index 2ca92561..9499879b 100644 --- a/latest-javadoc/com/google/inject/spi/ModuleWriter.html +++ b/latest-javadoc/com/google/inject/spi/ModuleWriter.html @@ -190,7 +190,7 @@ Creates a Module from a collection of component elements. <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected void</CODE></FONT></TD> -<TD><CODE><B><A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, +<TD><CODE><B><A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)">setPrivateBinder</A></B>(<A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, <A HREF="../../../../com/google/inject/binder/PrivateBinder.html" title="interface in com.google.inject.binder">PrivateBinder</A> binder)</CODE> <BR> @@ -271,7 +271,7 @@ Creates a Module from a collection of component elements. <A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> element)</CODE> <BR> - Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> + Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> @@ -448,7 +448,7 @@ writePrivateElements</H3> protected void <B>writePrivateElements</B>(<A HREF="../../../../com/google/inject/Binder.html" title="interface in com.google.inject">Binder</A> binder, <A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> element)</PRE> <DL> -<DD>Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two. +<DD>Writes the elements of the private environment to a new private binder and <A HREF="../../../../com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two. <P> <DD><DL> </DL> @@ -471,7 +471,7 @@ protected <T> <A HREF="../../../../com/google/inject/binder/ScopedBindingB </DL> <HR> -<A NAME="setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><!-- --></A><H3> +<A NAME="setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><!-- --></A><H3> setPrivateBinder</H3> <PRE> protected void <B>setPrivateBinder</B>(<A HREF="../../../../com/google/inject/spi/PrivateElements.html" title="interface in com.google.inject.spi">PrivateElements</A> privateElements, diff --git a/latest-javadoc/index-all.html b/latest-javadoc/index-all.html index d70cdcbf..6fdd3081 100644 --- a/latest-javadoc/index-all.html +++ b/latest-javadoc/index-all.html @@ -1183,7 +1183,7 @@ Static variable in class com.google.inject.servlet.<A HREF="./com/google/inject/ Static method in class com.google.inject.util.<A HREF="./com/google/inject/util/Types.html" title="class in com.google.inject.util">Types</A> <DD>Returns a type modelling a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><CODE>Set</CODE></A> whose elements are of type <code>elementType</code>. -<DT><A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><B>setPrivateBinder(PrivateElements, PrivateBinder)</B></A> - +<DT><A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><B>setPrivateBinder(PrivateElements, PrivateBinder)</B></A> - Method in class com.google.inject.spi.<A HREF="./com/google/inject/spi/ModuleWriter.html" title="class in com.google.inject.spi">ModuleWriter</A> <DD>Associates <code>binder</code> with <code>privateElements</code>. <DT><A HREF="./com/google/inject/Scopes.html#SINGLETON"><B>SINGLETON</B></A> - @@ -1522,7 +1522,7 @@ Method in class com.google.inject.spi.<A HREF="./com/google/inject/spi/ModuleWri <DD> <DT><A HREF="./com/google/inject/spi/ModuleWriter.html#writePrivateElements(com.google.inject.Binder, com.google.inject.spi.PrivateElements)"><B>writePrivateElements(Binder, PrivateElements)</B></A> - Method in class com.google.inject.spi.<A HREF="./com/google/inject/spi/ModuleWriter.html" title="class in com.google.inject.spi">ModuleWriter</A> -<DD>Writes the elements of the private environment to a new private binder and <A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.binder.PrivateBinder)"><CODE>associates</CODE></A> the two. +<DD>Writes the elements of the private environment to a new private binder and <A HREF="./com/google/inject/spi/ModuleWriter.html#setPrivateBinder(com.google.inject.spi.PrivateElements, com.google.inject.PrivateBinder)"><CODE>associates</CODE></A> the two. <DT><A HREF="./com/google/inject/Key.html#writeReplace()"><B>writeReplace()</B></A> - Method in class com.google.inject.<A HREF="./com/google/inject/Key.html" title="class in com.google.inject">Key</A> <DD> diff --git a/src/com/google/inject/Binder.java b/src/com/google/inject/Binder.java index b371ebdf..949ff857 100644 --- a/src/com/google/inject/Binder.java +++ b/src/com/google/inject/Binder.java @@ -19,7 +19,7 @@ package com.google.inject; import com.google.inject.binder.AnnotatedBindingBuilder; import com.google.inject.binder.AnnotatedConstantBindingBuilder; import com.google.inject.binder.LinkedBindingBuilder; -import com.google.inject.binder.PrivateBinder; +import com.google.inject.PrivateBinder; import com.google.inject.matcher.Matcher; import com.google.inject.spi.Message; import com.google.inject.spi.TypeConverter; diff --git a/src/com/google/inject/binder/PrivateBinder.java b/src/com/google/inject/PrivateBinder.java index 97d11e1c..21a833f6 100644 --- a/src/com/google/inject/binder/PrivateBinder.java +++ b/src/com/google/inject/PrivateBinder.java @@ -14,11 +14,9 @@ * limitations under the License. */ -package com.google.inject.binder; +package com.google.inject; -import com.google.inject.Binder; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; +import com.google.inject.binder.AnnotatedElementBuilder; /** * Returns a binder whose configuration information is hidden from its environment by default. See @@ -34,7 +32,7 @@ public interface PrivateBinder extends Binder { /** * Makes a binding for {@code type} available to the enclosing environment. Use {@link - * AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a + * com.google.inject.binder.AnnotatedElementBuilder#annotatedWith(Class) annotatedWith()} to expose {@code type} with a * binding annotation. */ AnnotatedElementBuilder expose(Class<?> type); diff --git a/src/com/google/inject/PrivateModule.java b/src/com/google/inject/PrivateModule.java index b00fe75c..8799e40c 100644 --- a/src/com/google/inject/PrivateModule.java +++ b/src/com/google/inject/PrivateModule.java @@ -21,7 +21,6 @@ import com.google.inject.binder.AnnotatedBindingBuilder; import com.google.inject.binder.AnnotatedConstantBindingBuilder; import com.google.inject.binder.AnnotatedElementBuilder; import com.google.inject.binder.LinkedBindingBuilder; -import com.google.inject.binder.PrivateBinder; import com.google.inject.matcher.Matcher; import com.google.inject.spi.Message; import com.google.inject.spi.TypeConverter; @@ -92,9 +91,10 @@ public abstract class PrivateModule implements Module { public final synchronized void configure(Binder binder) { checkState(this.binder == null, "Re-entry is not allowed."); + // Guice treats PrivateModules specially and passes in a PrivateBinder automatically. this.binder = (PrivateBinder) binder.skipSources(PrivateModule.class); try { - configurePrivateBindings(); + configure(); } finally { this.binder = null; } @@ -104,7 +104,7 @@ public abstract class PrivateModule implements Module { * Creates bindings and other configurations private to this module. Use {@link #expose(Class) * expose()} to make the bindings in this module available externally. */ - protected abstract void configurePrivateBindings(); + protected abstract void configure(); /** Makes the binding for {@code key} available to other modules and the injector. */ protected final <T> void expose(Key<T> key) { @@ -129,9 +129,6 @@ public abstract class PrivateModule implements Module { return binder.expose(type); } - // prevent classes migrated from AbstractModule from implementing the wrong method. - protected final void configure() {} - // everything below is copied from AbstractModule protected final Binder binder() { diff --git a/src/com/google/inject/internal/ProviderMethod.java b/src/com/google/inject/internal/ProviderMethod.java index 1af1bfe6..ef8642d7 100644 --- a/src/com/google/inject/internal/ProviderMethod.java +++ b/src/com/google/inject/internal/ProviderMethod.java @@ -21,7 +21,7 @@ import com.google.inject.Binder; import com.google.inject.Exposed; import com.google.inject.Key; import com.google.inject.Provider; -import com.google.inject.binder.PrivateBinder; +import com.google.inject.PrivateBinder; import com.google.inject.spi.Dependency; import com.google.inject.spi.ProviderWithDependencies; import java.lang.annotation.Annotation; diff --git a/src/com/google/inject/spi/Elements.java b/src/com/google/inject/spi/Elements.java index ebabfc9e..de3d2055 100644 --- a/src/com/google/inject/spi/Elements.java +++ b/src/com/google/inject/spi/Elements.java @@ -31,10 +31,10 @@ import com.google.inject.Provider; import com.google.inject.Scope; import com.google.inject.Stage; import com.google.inject.TypeLiteral; +import com.google.inject.PrivateBinder; import com.google.inject.binder.AnnotatedBindingBuilder; import com.google.inject.binder.AnnotatedConstantBindingBuilder; import com.google.inject.binder.AnnotatedElementBuilder; -import com.google.inject.binder.PrivateBinder; import com.google.inject.internal.AbstractBindingBuilder; import com.google.inject.internal.BindingBuilder; import com.google.inject.internal.ConstantBindingBuilderImpl; diff --git a/src/com/google/inject/spi/ModuleWriter.java b/src/com/google/inject/spi/ModuleWriter.java index 1b29a404..41da5dd8 100644 --- a/src/com/google/inject/spi/ModuleWriter.java +++ b/src/com/google/inject/spi/ModuleWriter.java @@ -25,7 +25,7 @@ import com.google.inject.Key; import com.google.inject.Module; import com.google.inject.Provider; import com.google.inject.Scope; -import com.google.inject.binder.PrivateBinder; +import com.google.inject.PrivateBinder; import com.google.inject.binder.ScopedBindingBuilder; import java.lang.annotation.Annotation; import java.util.List; diff --git a/test/com/google/inject/PrivateModuleTest.java b/test/com/google/inject/PrivateModuleTest.java index 23d4d2e5..d0a49763 100644 --- a/test/com/google/inject/PrivateModuleTest.java +++ b/test/com/google/inject/PrivateModuleTest.java @@ -18,7 +18,6 @@ package com.google.inject; import com.google.common.collect.ImmutableSet; import static com.google.inject.Asserts.assertContains; -import com.google.inject.binder.PrivateBinder; import com.google.inject.name.Named; import com.google.inject.name.Names; import static com.google.inject.name.Names.named; @@ -38,7 +37,7 @@ public class PrivateModuleTest extends TestCase { bind(String.class).annotatedWith(named("a")).toInstance("public"); install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).annotatedWith(named("b")).toInstance("i"); bind(AB.class).annotatedWith(named("one")).to(AB.class); @@ -47,7 +46,7 @@ public class PrivateModuleTest extends TestCase { }); install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).annotatedWith(named("b")).toInstance("ii"); bind(AB.class).annotatedWith(named("two")).to(AB.class); @@ -122,7 +121,7 @@ public class PrivateModuleTest extends TestCase { Injector injector = Guice.createInjector(new AbstractModule() { protected void configure() { install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { expose(String.class).annotatedWith(named("a")); } @@ -136,7 +135,7 @@ public class PrivateModuleTest extends TestCase { }); install(new PrivateModule() { - public void configurePrivateBindings() {} + public void configure() {} @Provides @Named("c") String providePrivateC() { return "private"; @@ -171,14 +170,14 @@ public class PrivateModuleTest extends TestCase { Guice.createInjector(new AbstractModule() { protected void configure() { install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).toInstance("public"); expose(String.class); } }); install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).toInstance("private"); } }); @@ -188,8 +187,8 @@ public class PrivateModuleTest extends TestCase { } catch (CreationException expected) { assertContains(expected.getMessage(), "A binding to java.lang.String was already configured at ", - getClass().getName(), ".configurePrivateBindings(PrivateModuleTest.java:", - " at " + getClass().getName(), ".configurePrivateBindings(PrivateModuleTest.java:"); + getClass().getName(), ".configure(PrivateModuleTest.java:", + " at " + getClass().getName(), ".configure(PrivateModuleTest.java:"); } } @@ -201,7 +200,7 @@ public class PrivateModuleTest extends TestCase { bind(String.class).annotatedWith(named("b")).toInstance("b"); install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { expose(AB.class); } }); @@ -211,7 +210,7 @@ public class PrivateModuleTest extends TestCase { } catch (CreationException expected) { assertContains(expected.getMessage(), "Could not expose() " + AB.class.getName() + ", it must be explicitly bound", - ".configurePrivateBindings(PrivateModuleTest.java:"); + ".configure(PrivateModuleTest.java:"); } } @@ -223,12 +222,12 @@ public class PrivateModuleTest extends TestCase { try { Guice.createInjector( new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(C.class); } }, new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(AB.class); } } @@ -237,7 +236,7 @@ public class PrivateModuleTest extends TestCase { } catch (CreationException expected) { assertContains(expected.getMessage(), "1) No implementation for " + C.class.getName() + " was bound.", - "at " + getClass().getName(), ".configurePrivateBindings(PrivateModuleTest.java:", + "at " + getClass().getName(), ".configure(PrivateModuleTest.java:", "2) No implementation for " + String.class.getName(), "Named(value=a) was bound.", "for field at " + AB.class.getName() + ".a(PrivateModuleTest.java:", "3) No implementation for " + String.class.getName(), "Named(value=b) was bound.", @@ -248,11 +247,11 @@ public class PrivateModuleTest extends TestCase { public void testNestedPrivateInjectors() { Injector injector = Guice.createInjector(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { expose(String.class); install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).toInstance("nested"); expose(String.class); } @@ -265,7 +264,7 @@ public class PrivateModuleTest extends TestCase { public void testInstallingRegularModulesFromPrivateModules() { Injector injector = Guice.createInjector(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { expose(String.class); install(new AbstractModule() { @@ -281,14 +280,14 @@ public class PrivateModuleTest extends TestCase { public void testNestedPrivateModulesWithSomeKeysUnexposed() { Injector injector = Guice.createInjector(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).annotatedWith(named("bound outer, exposed outer")).toInstance("boeo"); expose(String.class).annotatedWith(named("bound outer, exposed outer")); bind(String.class).annotatedWith(named("bound outer, exposed none")).toInstance("boen"); expose(String.class).annotatedWith(named("bound inner, exposed both")); install(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).annotatedWith(named("bound inner, exposed both")).toInstance("bieb"); expose(String.class).annotatedWith(named("bound inner, exposed both")); bind(String.class).annotatedWith(named("bound inner, exposed none")).toInstance("bien"); @@ -318,7 +317,7 @@ public class PrivateModuleTest extends TestCase { public void testDependenciesBetweenPrivateAndPublic() { Injector injector = Guice.createInjector( new PrivateModule() { - protected void configurePrivateBindings() {} + protected void configure() {} @Provides @Exposed @Named("a") String provideA() { return "A"; @@ -347,7 +346,7 @@ public class PrivateModuleTest extends TestCase { public void testDependenciesBetweenPrivateAndPublicWithPublicEagerSingleton() { Injector injector = Guice.createInjector( new PrivateModule() { - protected void configurePrivateBindings() {} + protected void configure() {} @Provides @Exposed @Named("a") String provideA() { return "A"; @@ -395,7 +394,7 @@ public class PrivateModuleTest extends TestCase { } }, new PrivateModule() { - protected void configurePrivateBindings() { + protected void configure() { bind(String.class).annotatedWith(named("abcde")).toProvider(new Provider<String>() { @Inject @Named("abcd") String abcd; @@ -428,7 +427,7 @@ public class PrivateModuleTest extends TestCase { public void testSpiAccess() { Injector injector = Guice.createInjector(new PrivateModule() { - public void configurePrivateBindings() { + public void configure() { bind(String.class).annotatedWith(named("a")).toInstance("private"); bind(String.class).annotatedWith(named("b")).toInstance("exposed"); expose(String.class).annotatedWith(named("b")); diff --git a/test/com/google/inject/spi/ElementsTest.java b/test/com/google/inject/spi/ElementsTest.java index 183c74e0..d901182a 100644 --- a/test/com/google/inject/spi/ElementsTest.java +++ b/test/com/google/inject/spi/ElementsTest.java @@ -28,10 +28,10 @@ import com.google.inject.Scope; import com.google.inject.Scopes; import com.google.inject.Singleton; import com.google.inject.TypeLiteral; +import com.google.inject.PrivateBinder; import com.google.inject.binder.AnnotatedBindingBuilder; import com.google.inject.binder.AnnotatedConstantBindingBuilder; import com.google.inject.binder.ConstantBindingBuilder; -import com.google.inject.binder.PrivateBinder; import com.google.inject.binder.ScopedBindingBuilder; import com.google.inject.matcher.Matcher; import com.google.inject.matcher.Matchers; |