Converting long list of if/else In order to convert a code such as:  

Company company = new Company();  
if(currentToken.equals("employee_list")) {  
   company.setEmployees((ArrayList&lt;Employee&gt; parseEmployees(reader));  
}    
else if(currentToken.equals("contractor_list")) {  
   company.setContractors((ArrayList&lt;Contractor&gt; parseContractors(reader));  
}    
else if(currentToken.equals("legal_name")) {  
   company.setLegalName((String)reader.nextString());  
}    
else if(currentToken.equals("profit")) {  
   company.setLegalName(Double.parseDouble((String)reader.nextString()));    
} ...etc  


I.e long list of if/else reading from a stream and populating the object I did the following:  

public interface CustomSetter&lt;T&gt; {  
  void setToObject(T o, Reader r);  
}

HashMap&lt;String, CustomSetter&gt; setters = new HashMap&lt;&gt;();  
setters.put("employee_list", new CustomSetter&lt;Company&gt;() { 
     public void setObject(Company company, Reader reader) {  
        company.setEmployees((ArrayList&lt;Employee&gt; parseEmployees(reader));   
     }  
 });  

setters.put("contractor_list", new CustomSetter&lt;Company&gt;() { 
     public void setObject(Company company, Reader reader) {  
        company.setContractors((ArrayList&lt;Contractor&gt; parseContractors(reader));   
     }  
 });   


etc.
Effectively doing:  

setters.get(currentToken).setObject(company, reader);  


So now I have all these initialized in my hashmap.
What do you think of this approach? Can it be improved?
I would assume that Company has e setter method signature as setEmployees(List employees) or setEmployees(Arraylist employees) or some ? wildcard setter, since it accepts as parameter List&lt;Employee&gt; and List&lt;Contractor&gt;. 

I would also assume that Employee and Contractor extend one another or the same super class.

In that case, I don't see the benefit of creating such a custom generic setter. Instead I would use the same setter, and mitigate the type identification in the parsing method: company.setEmployees(parseFromReader(currentToken, reader))
and have the List&lt;Employee&gt; parseFromReader(currentToken, reader) worry about the specific instance type, since I assume also most of the information to be parsed would be the same (if the classes extend the same super class).