blob: 0b502270a846a6dbb88a77c9c98cc044699f86d8 [file] [log] [blame]
kevinb9n75ed16f2007-03-13 04:40:02 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.5.0_07) on Mon Mar 12 21:35:31 PDT 2007 -->
6<TITLE>
7Guice (Guice 1.0 API)
8</TITLE>
9
10<META NAME="keywords" CONTENT="com.google.inject.Guice class">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17 parent.document.title="Guice (Guice 1.0 API)";
18}
19</SCRIPT>
20<NOSCRIPT>
21</NOSCRIPT>
22
23</HEAD>
24
25<BODY BGCOLOR="white" onload="windowTitle();">
26
27
28<!-- ========= START OF TOP NAVBAR ======= -->
29<A NAME="navbar_top"><!-- --></A>
30<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32<TR>
33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34<A NAME="navbar_top_firstrow"><!-- --></A>
35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36 <TR ALIGN="center" VALIGN="top">
37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44 </TR>
45</TABLE>
46</TD>
47<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48</EM>
49</TD>
50</TR>
51
52<TR>
53<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54&nbsp;<A HREF="../../../com/google/inject/CreationException.html" title="class in com.google.inject"><B>PREV CLASS</B></A>&nbsp;
55&nbsp;<A HREF="../../../com/google/inject/ImplementedBy.html" title="annotation in com.google.inject"><B>NEXT CLASS</B></A></FONT></TD>
56<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57 <A HREF="../../../index.html?com/google/inject/Guice.html" target="_top"><B>FRAMES</B></A> &nbsp;
58&nbsp;<A HREF="Guice.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
59&nbsp;<SCRIPT type="text/javascript">
60 <!--
61 if(window==top) {
62 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
63 }
64 //-->
65</SCRIPT>
66<NOSCRIPT>
67 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
68</NOSCRIPT>
69
70
71</FONT></TD>
72</TR>
73<TR>
74<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78</TR>
79</TABLE>
80<A NAME="skip-navbar_top"></A>
81<!-- ========= END OF TOP NAVBAR ========= -->
82
83<HR>
84<!-- ======== START OF CLASS DATA ======== -->
85<H2>
86<FONT SIZE="-1">
87com.google.inject</FONT>
88<BR>
89Class Guice</H2>
90<PRE>
91<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
92 <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.google.inject.Guice</B>
93</PRE>
94<HR>
95<DL>
96<DT><PRE>public final class <B>Guice</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL>
97</PRE>
98
99<P>
100The entry point to the Guice framework. Creates <A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject"><CODE>Injector</CODE></A>s from
101 <A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject"><CODE>Module</CODE></A>s.
102
103 <p>Guice supports a model of development that draws clear boundaries between
104 APIs, Implementations of these APIs, Modules which configure these
105 implementations, and finally Applications which consist of a collection of
106 Modules. It is the Application, which typically defines your <code>main()</code>
107 method, that bootstraps the Guice Injector using the <code>Guice</code> class, as
108 in this example:
109 <pre>
110 public class FooApplication {
111 public static void main(String[] args) {
112 Injector injector = Guice.createInjector(
113 new ModuleA(),
114 new ModuleB(),
115 . . .
116 new FooApplicationFlagsModule(args)
117 );
118
119 // Now just bootstrap the application and you're done
120 MyStartClass starter = injector.getInstance(MyStartClass.class);
121 starter.runApplication();
122 }
123 }
124 </pre>
125<P>
126
127<P>
128<HR>
129
130<P>
131
132<!-- ========== METHOD SUMMARY =========== -->
133
134<A NAME="method_summary"><!-- --></A>
135<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
136<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
137<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
138<B>Method Summary</B></FONT></TH>
139</TR>
140<TR BGCOLOR="white" CLASS="TableRowColor">
141<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
142<CODE>static&nbsp;<A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A></CODE></FONT></TD>
143<TD><CODE><B><A HREF="../../../com/google/inject/Guice.html#createInjector(java.lang.Iterable)">createInjector</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>&gt;&nbsp;modules)</CODE>
144
145<BR>
146&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an injector for the given set of modules.</TD>
147</TR>
148<TR BGCOLOR="white" CLASS="TableRowColor">
149<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
150<CODE>static&nbsp;<A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A></CODE></FONT></TD>
151<TD><CODE><B><A HREF="../../../com/google/inject/Guice.html#createInjector(com.google.inject.Module...)">createInjector</A></B>(<A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>...&nbsp;modules)</CODE>
152
153<BR>
154&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an injector for the given set of modules.</TD>
155</TR>
156<TR BGCOLOR="white" CLASS="TableRowColor">
157<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
158<CODE>static&nbsp;<A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A></CODE></FONT></TD>
159<TD><CODE><B><A HREF="../../../com/google/inject/Guice.html#createInjector(com.google.inject.Stage, java.lang.Iterable)">createInjector</A></B>(<A HREF="../../../com/google/inject/Stage.html" title="enum in com.google.inject">Stage</A>&nbsp;stage,
160 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>&gt;&nbsp;modules)</CODE>
161
162<BR>
163&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an injector for the given set of modules, in a given development
164 stage.</TD>
165</TR>
166<TR BGCOLOR="white" CLASS="TableRowColor">
167<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
168<CODE>static&nbsp;<A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A></CODE></FONT></TD>
169<TD><CODE><B><A HREF="../../../com/google/inject/Guice.html#createInjector(com.google.inject.Stage, com.google.inject.Module...)">createInjector</A></B>(<A HREF="../../../com/google/inject/Stage.html" title="enum in com.google.inject">Stage</A>&nbsp;stage,
170 <A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>...&nbsp;modules)</CODE>
171
172<BR>
173&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an injector for the given set of modules, in a given development
174 stage.</TD>
175</TR>
176</TABLE>
177&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
178<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
179<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
180<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH>
181</TR>
182<TR BGCOLOR="white" CLASS="TableRowColor">
183<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
184</TR>
185</TABLE>
186&nbsp;
187<P>
188
189<!-- ============ METHOD DETAIL ========== -->
190
191<A NAME="method_detail"><!-- --></A>
192<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
193<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
194<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
195<B>Method Detail</B></FONT></TH>
196</TR>
197</TABLE>
198
199<A NAME="createInjector(com.google.inject.Module...)"><!-- --></A><H3>
200createInjector</H3>
201<PRE>
202public static <A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A> <B>createInjector</B>(<A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>...&nbsp;modules)</PRE>
203<DL>
204<DD>Creates an injector for the given set of modules.
205<P>
206<DD><DL>
207
208<DT><B>Throws:</B>
209<DD><CODE><A HREF="../../../com/google/inject/CreationException.html" title="class in com.google.inject">CreationException</A></CODE> - if one or more errors occur during Injector
210 construction</DL>
211</DD>
212</DL>
213<HR>
214
215<A NAME="createInjector(java.lang.Iterable)"><!-- --></A><H3>
216createInjector</H3>
217<PRE>
218public static <A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A> <B>createInjector</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>&gt;&nbsp;modules)</PRE>
219<DL>
220<DD>Creates an injector for the given set of modules.
221<P>
222<DD><DL>
223
224<DT><B>Throws:</B>
225<DD><CODE><A HREF="../../../com/google/inject/CreationException.html" title="class in com.google.inject">CreationException</A></CODE> - if one or more errors occur during Injector
226 construction</DL>
227</DD>
228</DL>
229<HR>
230
231<A NAME="createInjector(com.google.inject.Stage, com.google.inject.Module...)"><!-- --></A><H3>
232createInjector</H3>
233<PRE>
234public static <A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A> <B>createInjector</B>(<A HREF="../../../com/google/inject/Stage.html" title="enum in com.google.inject">Stage</A>&nbsp;stage,
235 <A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>...&nbsp;modules)</PRE>
236<DL>
237<DD>Creates an injector for the given set of modules, in a given development
238 stage.
239<P>
240<DD><DL>
241
242<DT><B>Throws:</B>
243<DD><CODE><A HREF="../../../com/google/inject/CreationException.html" title="class in com.google.inject">CreationException</A></CODE> - if one or more errors occur during Injector
244 construction</DL>
245</DD>
246</DL>
247<HR>
248
249<A NAME="createInjector(com.google.inject.Stage, java.lang.Iterable)"><!-- --></A><H3>
250createInjector</H3>
251<PRE>
252public static <A HREF="../../../com/google/inject/Injector.html" title="interface in com.google.inject">Injector</A> <B>createInjector</B>(<A HREF="../../../com/google/inject/Stage.html" title="enum in com.google.inject">Stage</A>&nbsp;stage,
253 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/inject/Module.html" title="interface in com.google.inject">Module</A>&gt;&nbsp;modules)</PRE>
254<DL>
255<DD>Creates an injector for the given set of modules, in a given development
256 stage.
257<P>
258<DD><DL>
259
260<DT><B>Throws:</B>
261<DD><CODE><A HREF="../../../com/google/inject/CreationException.html" title="class in com.google.inject">CreationException</A></CODE> - if one or more errors occur during Injector
262 construction</DL>
263</DD>
264</DL>
265<!-- ========= END OF CLASS DATA ========= -->
266<HR>
267
268
269<!-- ======= START OF BOTTOM NAVBAR ====== -->
270<A NAME="navbar_bottom"><!-- --></A>
271<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
272<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
273<TR>
274<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
275<A NAME="navbar_bottom_firstrow"><!-- --></A>
276<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
277 <TR ALIGN="center" VALIGN="top">
278 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
279 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
280 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
281 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
282 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
283 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
284 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
285 </TR>
286</TABLE>
287</TD>
288<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
289</EM>
290</TD>
291</TR>
292
293<TR>
294<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
295&nbsp;<A HREF="../../../com/google/inject/CreationException.html" title="class in com.google.inject"><B>PREV CLASS</B></A>&nbsp;
296&nbsp;<A HREF="../../../com/google/inject/ImplementedBy.html" title="annotation in com.google.inject"><B>NEXT CLASS</B></A></FONT></TD>
297<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
298 <A HREF="../../../index.html?com/google/inject/Guice.html" target="_top"><B>FRAMES</B></A> &nbsp;
299&nbsp;<A HREF="Guice.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
300&nbsp;<SCRIPT type="text/javascript">
301 <!--
302 if(window==top) {
303 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
304 }
305 //-->
306</SCRIPT>
307<NOSCRIPT>
308 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
309</NOSCRIPT>
310
311
312</FONT></TD>
313</TR>
314<TR>
315<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
316 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
317<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
318DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
319</TR>
320</TABLE>
321<A NAME="skip-navbar_bottom"></A>
322<!-- ======== END OF BOTTOM NAVBAR ======= -->
323
324<HR>
325
326</BODY>
327</HTML>