-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for jakarta.inject to core Guice.
This does not add support for `toProvider(...)` to instances of `jakarta.inject.Provider` or classes/keys/typeLiterals of type `jakarta.inject.Provider`. See #1383 (comment) for details of the plans. The Guice 6.0 release will support `javax.inject` _and_ `jakarta.inject` (excluding `toProvider()` support for `jakarta.inject`), and the Guice 7.0+ release will remove the `javax.inject` references. Further background on these issues: * #1630 * #1679 * #1490 * #1383 PiperOrigin-RevId: 526763665
- Loading branch information
Showing
36 changed files
with
1,235 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,24 +21,24 @@ | |
* by Guice: | ||
* | ||
* <ul> | ||
* <li>When the default means for obtaining instances (an injectable or parameterless constructor) | ||
* is insufficient for a particular binding, the module can specify a custom {@code Provider} | ||
* instead, to control exactly how Guice creates or obtains instances for the binding. | ||
* <li>An implementation class may always choose to have a {@code Provider<T>} instance injected, | ||
* rather than having a {@code T} injected directly. This may give you access to multiple | ||
* instances, instances you wish to safely mutate and discard, instances which are out of scope | ||
* (e.g. using a {@code @RequestScoped} object from within a {@code @SessionScoped} object), or | ||
* instances that will be initialized lazily. | ||
* <li>A custom {@link Scope} is implemented as a decorator of {@code Provider<T>}, which decides | ||
* when to delegate to the backing provider and when to provide the instance some other way. | ||
* <li>The {@link Injector} offers access to the {@code Provider<T>} it uses to fulfill requests for | ||
* a given key, via the {@link Injector#getProvider} methods. | ||
* <li>When the default means for obtaining instances (an injectable or parameterless constructor) | ||
* is insufficient for a particular binding, the module can specify a custom {@code Provider} | ||
* instead, to control exactly how Guice creates or obtains instances for the binding. | ||
* <li>An implementation class may always choose to have a {@code Provider<T>} instance injected, | ||
* rather than having a {@code T} injected directly. This may give you access to multiple | ||
* instances, instances you wish to safely mutate and discard, instances which are out of | ||
* scope (e.g. using a {@code @RequestScoped} object from within a {@code @SessionScoped} | ||
* object), or instances that will be initialized lazily. | ||
* <li>A custom {@link Scope} is implemented as a decorator of {@code Provider<T>}, which decides | ||
* when to delegate to the backing provider and when to provide the instance some other way. | ||
* <li>The {@link Injector} offers access to the {@code Provider<T>} it uses to fulfill requests | ||
* for a given key, via the {@link Injector#getProvider} methods. | ||
* </ul> | ||
* | ||
* @param <T> the type of object this provides | ||
* @author [email protected] (Bob Lee) | ||
*/ | ||
public interface Provider<T> extends javax.inject.Provider<T> { | ||
public interface Provider<T> extends javax.inject.Provider<T>, jakarta.inject.Provider<T> { | ||
|
||
/** | ||
* Provides an instance of {@code T}. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.