1 package cz.cuni.amis.pogamut.base.utils.guice;
2
3 import com.google.inject.Provider;
4
5 /**
6 * Adapts the value from some {@link Provider} to by of type "T".
7 * <p><p>
8 * Usually not needed, as you can cast the provider to a provider of different type.
9 *
10 * @author Jimmy
11 *
12 * @param <T>
13 */
14 public class ProviderAdapter<T> implements Provider<T> {
15
16 private Provider provider;
17
18 public ProviderAdapter(Provider wrappedProvider) {
19 this.provider = wrappedProvider;
20 }
21
22 @Override
23 public T get() {
24 return (T) provider.get();
25 }
26
27 }