Package org.eclipse.sisu.inject
Class Guice4
java.lang.Object
org.eclipse.sisu.inject.Guice4
Utility methods for dealing with changes in the Guice 4.0 SPI.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getDeclaringSource
(com.google.inject.Binding<?> binding) Returns the source that originally declared the given binding.static javax.inject.Provider
<?> getProviderInstance
(com.google.inject.spi.ProviderInstanceBinding<?> binding) Returns the provider that originally backed the given binding.static Object
invokeStaticBinding
(com.google.inject.Binding<?> binding) Attempts to invoke the given binding statically; returnsnull
if the binding isn't static.static <T> javax.inject.Provider
<T> lazy
(com.google.inject.Binding<T> binding) Returns a lazy provider that only uses the binding once and caches the result.
-
Method Details
-
getDeclaringSource
Returns the source that originally declared the given binding.- Parameters:
binding
- The binding- Returns:
- Declaring source;
null
if it doesn't exist
-
getProviderInstance
public static javax.inject.Provider<?> getProviderInstance(com.google.inject.spi.ProviderInstanceBinding<?> binding) Returns the provider that originally backed the given binding.- Parameters:
binding
- The binding- Returns:
- Provider instance
-
invokeStaticBinding
Attempts to invoke the given binding statically; returnsnull
if the binding isn't static.- Parameters:
binding
- The binding- Returns:
- Statically bound instance
-
lazy
public static <T> javax.inject.Provider<T> lazy(com.google.inject.Binding<T> binding) Returns a lazy provider that only uses the binding once and caches the result.- Parameters:
binding
- The binding- Returns:
- Lazy caching provider
-