我有一个抽象的泛型类:
public abstract class AbstractMessageHandler<T extends AbstractMessageHandler>
{
public abstract List<String> getTypesOfMessages();
public abstract void handleMessage(String message, CometClient client);
public T setResponseValues(AbstractMessage request, T response )
{
response.setCompanyId(request.getCompanyId());
response.setMessageGroup(request.getMessageGroup());
response.setUserId(request.getUserId());
response.setTimeStamp(AbstractMessage.getCurrentTimeStamp());
return response;
}
}
我需要通用子类成为此类的子类。换句话说,泛型必须是 AbstractMessageHandler 的子类。然而,这给了我编译问题。谁能让我知道我做错了什么?
谢谢