|
DRAFT | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Provider<T>
Provides instances of T. Typically implemented by an injector. For
any type T that can be injected, you can also inject
Provider<T>. Compared to injecting T directly, injecting
Provider<T> enables:
For example:
class Car {
@Inject Car(Provider<Seat> seatProvider) {
Seat driver = seatProvider.get();
Seat passenger = seatProvider.get();
...
}
}
| Method Summary | |
|---|---|
T |
get()
Provides a fully-constructed and injected instance of T. |
| Method Detail |
|---|
T get()
T.
java.lang.RuntimeException - if the injector encounters an error while
providing an instance. For example, if an injectable member on
T throws an exception, the injector may wrap the exception
and throw it to the caller of get(). Callers should not try
to handle such exceptions as the behavior may vary across injector
implementations and even different configurations of the same injector.
|
DRAFT | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.
Generated on 24-November-2009 03:24