我有一个通用接口定义为:
$(document).ready(function(){
var date_input=$('input[name="date"]'); //our date input has the name "date"
var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body";
var options={
format: 'dd.mm.yyyy',
container: container,
language: "de",
autoclose: true,
endDate: "-18y"
};
date_input.datepicker(options);
})
和一个实现:
public interface Service<T extends Slicer, E extends Slice> {
}
如果我尝试实例化public class DynamoDbService implements Service<DynamoDbSlicer, DynamoDbSlice> {
}
并将其分配给类型为DynamoDbService
的变量,如下所示:
Service<DynamoDbSlicer, DynamoDbSlice>
我收到一个public class Test {
private void test() {
final Service<Slicer, Slice> service = new DynamoDbService();
}
}
错误:
incompatible types
当Incompatible types.
Required: Service <Slicer, Slice>
Found: DynamoDbService
实现通用接口时,这不行吗?以下没有泛型的示例可以满足我的期望,以及我希望上一个示例如何工作:
DynamoDbService