There is a little mistake here, shouldn't one of these be class1, this is where you want to always have a unit test, can you please add a unit test to ensure that if you had a list of supported classes and more than one match the passed in type, the most specific is what gets picked always even when it is the last in the list.