Use Class#isAssignableFrom instead of string comparisons for instanceof.

This catches super classes, abstract classes and interfaces as well.