我正在开发一个android应用程序,我正在尝试注入一个在抽象类中参数化的字段:BaseListFragment
public abstract class BaseListFragment<E, A extends ArrayAdapter<E>, S> extends BaseFragment
{
@Inject protected S service;
}
但我在编译时收到以下错误:错误:找不到符号类 S
这是我的 BaseFragment 代码:
public class BaseFragment extends Fragment
{
@Override public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
((App) getActivity().getApplication()).inject(this);
}
}
这是我的服务模块:
@Module(
complete = false,
library = true
)
public class ServiceModule
{
@Provides @Singleton BucketService provideBucketService(RestAdapter restAdapter)
{
return restAdapter.create(BucketService.class);
}
@Provides @Singleton ProjectService provideProjectService(RestAdapter restAdapter)
{
return restAdapter.create(ProjectService.class);
}
@Provides @Singleton ShotService provideShotService(RestAdapter restAdapter)
{
return restAdapter.create(ShotService.class);
}
@Provides @Singleton TeamService provideTeamService(RestAdapter restAdapter)
{
return restAdapter.create(TeamService.class);
}
@Provides @Singleton UserService provideUserService(RestAdapter restAdapter)
{
return restAdapter.create(UserService.class);
}
}
这是扩展 BaseListFragment 的类的示例:
public class ProjectFragment extends BaseEntityFragment<Project, ProjectViewAdapter, ProjectService>
{
}
反正有注入参数化类型吗?
问候,