What is the best solution to resolve the following problem?
Problem: I would like to implement generic business logic (method) which can be invoked by any methods irrespective input type.
public <complexType> GenericMethod(<ComplexType>)
... business logic implementation
... return <complexType>
Client Method 1:
public <complexType> Client1(<complexType1>)
... call GenericMethod<complexType1>)
Client Method 2:
public <complexType> Client1(<complexType2>)
... call GenericMethod<complexType2>)
Question: If you have noticed, In above scenario "Client Method1" and "ClientMethod2" is passing different input type and method is expecting same return type.
Is there any pattern or mechanism which will decide type and based on that it will invoke appropriate method.