typeliteral

    2熱度

    2回答

    我有一個接口DAO<T>,它的一個通用實現(GenericDAO<T> implements DAO<T>)。 我就喜歡做這樣的事情: public interface UserDao extends Dao<User> { // code } // module bind(UserDao.class).to(GenericDao.class); 這可能嗎? 我設法工作道的注入,自動

    -1熱度

    2回答

    假設我有這樣的: public class Foo<T> { @Inject public Foo(Class<T> tClass); } public class FooProvider<T> implements Provider<Foo<T>> { @Inject private TypeLiteral<T> type; @Override pu

    0熱度

    1回答

    我遇到了一個錯誤,試圖讓guice連線。下面是轉載我看到的問題的一些示例代碼: public class GuiceGenerics<K, V> { public static interface Foo<K, V> { } public static class FooImpl<K, V> implements Foo<K, V> { }

    0熱度

    3回答

    我有一個字符串字面型後衛 type Status = 'new' | 'update' | 'close'; itemRequest(status: Status) { itemService.subscribeToChanges(status) //third party library method } 難我有一個方法是這樣的第三方方法接受字符串不是我的自定義字符串類型St

    41熱度

    3回答

    我希望能夠使用Guice注入通用接口的通用實現。 public interface Repository<T> { void save(T item); T get(int id); } public MyRepository<T> implements Repository<T> { @Override public void save(T item