I need to create a mapper object based on the input type, is there a simple solution without switch case or if else conditions? Below is an example. Can you please help me to provide a simple working example for this?
Mapper mapper = null;
if(requestType=="AAA"){
mapper = RequestMapperAAA.createTypeRequest(inputpayload);
} else if(requestType=="BBB"){
mapper = RequestMapperBBB.createTypeRequest(inputpayload);
} else if(requestType=="CCC"){
mapper = RequestMapperCCC.createTypeRequest(inputpayload);
} else if(requestType=="DDD"){
mapper = RequestMapperDDD.createTypeRequest(inputpayload);
} so on.. upto 20 input types