I have an abstract generic class:
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;
}
}
I need the generic subclass to be a subclass of this class. In otherwords, the generic must be a subclass of AbstractMessageHandler. This however gives me compilation issues. Can anyone let me know what I am doing wrong?
Thanks
You need to follow the example of the Enum class: