如果我有一个适合泛型的类,有没有办法包装这种丑陋?
所以这
public HasOne aMethod(Class<? extends Model> clazz){
HasOne<Customer> hasOne = injector.getInstance(Key.get(new TypeLiteral<HasOne<Customer>>() {
}));
return hasOne;
}
会变成这样的东西。(这显然不能编译)
public HasOne aMethod(Class<? extends Model> clazz){
HasOne<clazz> hasOne = injector.getInstance(Key.get(new TypeLiteral<HasOne<clazz>>() {
}));
return hasOne;
}