I would create a Factory Class for your customer objects. Then when you need an object of a certain type, you simply pass the String containing your desired class and the Factory returns the object.
public class CustomerFactory {
private CustomerFactory()
{
//do nothing
}
public static Customer CreateCustomer(String customerType)
{
if(customerType == null)
return null;
else if(customerType.equals("CustomerA"))
return new CustomerA();
else if(customerType.equals("CustomerB"))
return new CustomerB();
else
return null;
}
}
This works as long as your Customer's all extend the parent Customer class. Then you could use the factory to give you back a class object of your choosing based on the String passed in like the following
CustomerA obj1 = CustomerFactory.CreateCustomer("CustomerA");
CustomerB obj2 = CustomerFactory.CreateCustomer("CustomerB");