code: private static boolean isCompatibleClasses(final Class<?> one, final Class<?> two) {
          return one.isAssignableFrom(two) || two.isAssignableFrom(one);
      }
docs: Classes are compatible if one can be casted to another (or they are equal).
  
  @param one first class
  @param two second class
  @return true is classes are compatible, false otherwise