我的情况是:保存方法ResourceService<T , ID >
public interface IResourceService<T,ID>
public class ResourceService<T , ID> implement IResourceService<T,ID>
{
public void save(T entity) throws RuntimeException {
try {
AsyncServiceSaveRunable<T> task = new
AsyncServiceSaveRunable<T>(getService(),entity);
this.treadPoolExcutor.submitTask(task);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
并且在
public class AsyncServiceSaveRunable<T> implements Runnable {
private IResourceService<?,?> service; //----> this is
private Method serviceMethod;
private List<T> parameters;
public AsyncServiceSaveRunable(IResourceService<?,?> service, List<T> parameters){
}
public AsyncServiceSaveRunable(IResourceService<?,?> service, T parameter)
throws NoSuchMethodException, SecurityException{
this.service = service;
this.parameters = new ArrayList<T>();
this.parameters.add(parameter);
}
@Override
public void run() {
try {
if(this.parameters.size()>1)
service.saveList(this.parameters);
else
service.save( this.parameters.get(0));
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
问题是 service.saveList(this.parameters); 和 service.save(...); 错了
无论如何要传递该参数还是我需要不同的结构来处理这种情况?
谢谢
------------------ 来自 Eclipse 的错误消息 ------------------------
The method save(capture#7-of ?) in the type IResourceService<capture#7-of ?,capture#8-of ?>
is not applicable for the arguments (T)