Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added default javax.inject comments to the Kotlin common components
- Loading branch information
Showing
6 changed files
with
288 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,41 @@ | ||
package com.chrynan.inject | ||
|
||
/** | ||
* Provides instances of {@code T}. Typically implemented by an injector. For | ||
* any type {@code T} that can be injected, you can also inject | ||
* {@code Provider<T>}. Compared to injecting {@code T} directly, injecting | ||
* {@code Provider<T>} enables: | ||
* | ||
* <ul> | ||
* <li>retrieving multiple instances.</li> | ||
* <li>lazy or optional retrieval of an instance.</li> | ||
* <li>breaking circular dependencies.</li> | ||
* <li>abstracting scope so you can look up an instance in a smaller scope | ||
* from an instance in a containing scope.</li> | ||
* </ul> | ||
* | ||
* <p>For example: | ||
* | ||
* <pre> | ||
* class Car { | ||
* @Inject Car(Provider<Seat> seatProvider) { | ||
* Seat driver = seatProvider.get(); | ||
* Seat passenger = seatProvider.get(); | ||
* ... | ||
* } | ||
* }</pre> | ||
*/ | ||
expect interface Provider<T> { | ||
|
||
/** | ||
* Provides a fully-constructed and injected instance of {@code T}. | ||
* | ||
* @throws RuntimeException if the injector encounters an error while | ||
* providing an instance. For example, if an injectable member on | ||
* {@code T} throws an exception, the injector may wrap the exception | ||
* and throw it to the caller of {@code 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. | ||
*/ | ||
fun get(): 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