Creating a factory method in Java that doesn’t rely on if-else

Hello,
I need a help in factory method in Java,please
Currently I have a method that acts as a factory based on a given String.
What I want to do is avoid the entire if-else issue when the list of classes grows. I figure I need to have two methods, one that registers Strings to classes and another that returns the class based on the String of the action.
What's a nice way to do this in Java?
