Package com.google.inject.util
Class Providers
- java.lang.Object
-
- com.google.inject.util.Providers
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> Provider<T>
guicify(Provider<T> provider)
Deprecated.Marked as deprecated as a hint to users that calling this is unnecessary, because the provider is already a guice Provider.static <T> Provider<T>
guicify(jakarta.inject.Provider<T> provider)
Returns a Guice-friendlycom.google.inject.Provider
for the givenjakarta.inject.Provider
.static <T> Provider<T>
guicify(javax.inject.Provider<T> provider)
Returns a Guice-friendlycom.google.inject.Provider
for the given JSR-330javax.inject.Provider
.static <T> Provider<T>
of(T instance)
Returns a provider which always providesinstance
.
-
-
-
Method Detail
-
of
public static <T> Provider<T> of(T instance)
Returns a provider which always providesinstance
. This should not be necessary to use in your application, but is helpful for several types of unit tests.- Parameters:
instance
- the instance that should always be provided. This is also permitted to be null, to enable aggressive testing, although in real life a Guice-supplied Provider will never return null.
-
guicify
@Deprecated public static <T> Provider<T> guicify(Provider<T> provider)
Deprecated.Marked as deprecated as a hint to users that calling this is unnecessary, because the provider is already a guice Provider.Returns itself. This exists primarily to avoid ambiguous method reference compile errors when calling guicify with a Guice provider.- Since:
- 6.0
-
guicify
public static <T> Provider<T> guicify(javax.inject.Provider<T> provider)
Returns a Guice-friendlycom.google.inject.Provider
for the given JSR-330javax.inject.Provider
. The converse method is unnecessary, since Guice providers directly implement the JSR-330 interface.- Since:
- 3.0
-
guicify
public static <T> Provider<T> guicify(jakarta.inject.Provider<T> provider)
Returns a Guice-friendlycom.google.inject.Provider
for the givenjakarta.inject.Provider
. The converse method is unnecessary, since Guice providers directly implement the jakarta.inject.Provider interface.- Since:
- 6.0
-
-