Does this need to return just the class or could it return an instance? If this is only used to create immediately create an instance of the class you could do the instantiation here and catch ClassCastException etc. so that it doesn't have to be dealt with elsewhere. It would probably also let you fail fast if the class is the wrong type.