Unless I've totally misunderstood your question, you don't - and shouldn't - use generic for this kind of problem. Using polymorphism and/or composition will be much more appropriate. For example, if you need to integrate a copy of the request in the response (hardly necessary but thinkable) then you can add a reference to a request object in your response class.
Technically, this reference to a Request
object could be defined using a type; however, you shouldn't do that because it will always be a Request
object (either a base class or a derived subclass) and not some kind of arbitrary class that could change with each instanciation of a response.
You use generic when the type of each referenced object is totally different (for example, a List <String>
or a List<Request>
: there is no subclassing relationship between a String
and a Request
object) or when the use of polymorphism will not be sufficient because you are defining one or more new virtual functions in a subclass that are not present in the superclass.
Building a Response
to be based on a Request
because a Request
is processed to yield a Response
is definitely not the way to go and your current Processor
interface is a testimony to that.