我想做的是创建地图,其中关键将是扩展我的抽象类的类
GinMapBinder<Class<? extends Key>, Value> mapBinder = GinMapBinder
.newMapBinder(binder(),
new TypeLiteral<Class<? extends Key>>() {
}, new TypeLiteral<Value>() {
});
但是当我尝试填充我的地图时
mapBinder.addBinding(KeyImpl.class).to(Value.class);
我收到错误:
Error injecting @com.google.gwt.inject.client.multibindings.Internal() java.lang.Class<? extends my.test.gwt.gin.objects.Key>: Unable to create or inherit binding: No implementation bound for '@com.google.gwt.inject.client.multibindings.Internal() java.lang.Class<? extendsmy.test.gwt.gin.objects.Key>' and an implicit binding cannot be created because the type is annotated.
Path to required node:
@com.google.gwt.inject.client.multibindings.Internal com.google.gwt.inject.client.multibindings.MapEntry<java.lang.Class<? extends my.test.gwt.gin.objects.Key>, my.test.gwt.gin.objects.Value> [com.google.gwt.inject.client.multibindings.BindingRecorder.bind(BindingRecorder.java:42)]
-> com.google.gwt.inject.client.multibindings.MapEntry<java.lang.Class<? extends my.test.gwt.gin.objects.Key>, my.test.gwt.gin.objects.Value> [com.google.gwt.inject.client.multibindings.BindingRecorder.bind(BindingRecorder.java:42)]
-> @com.google.gwt.inject.client.multibindings.Internal() java.lang.Class<? extends my.test.gwt.gin.objects.Key> [@Inject constructor of com.google.gwt.inject.client.multibindings.MapEntry<java.lang.Class<? extends my.test.gwt.gin.objects.Key>, my.test.gwt.gin.objects.Value>]
如果我不使用TypeLiteral
它会起作用,但我不想要原始类型的类。所以如果有人可以帮助我解决这个问题,我会很高兴。提前致谢