private static float getObjectTransformationCost(Class<?> srcClass, final Class<?> destClass) {
    if (destClass.isPrimitive()) {
      return getPrimitivePromotionCost(srcClass, destClass);
    }
    float cost = 0.0f;
    while (srcClass != null && !destClass.equals(srcClass)) {
      if (destClass.isInterface() && ClassUtils.isAssignable(srcClass, destClass)) {
        // slight penalty for interface match.
        // we still want an exact match to override an interface match,
        // but
        // an interface match should override anything where we have to
        // get a superclass.
        cost += 0.25f;
        break;
      }
      cost++;
      srcClass = srcClass.getSuperclass();
    }
    /*
     * If the destination class is null, we've traveled all the way up to
     * an Object match. We'll penalize this by adding 1.5 to the cost.
     */
    if (srcClass == null) {
      cost += 1.5f;
    }
    return cost;
  }
private static float getObjectTransformationCost(Class<?> srcClass, final Class<?> destClass) {
    if (destClass.isPrimitive()) {
      return getPrimitivePromotionCost(srcClass, destClass);
    }
    float cost = 0.0f;
    while (srcClass != null && !destClass.equals(srcClass)) {
      if (destClass.isInterface() && ClassUtils.isAssignable(srcClass, destClass)) {
        
        
        
        
        
        cost += 0.25f;
        break;
      }
      cost++;
      srcClass = srcClass.getSuperclass();
    }
    
    if (srcClass == null) {
      cost += 1.5f;
    }
    return cost;
  }
private static float getObjectTransformationCost ( Class < ? > srcClass , final Class < ? > destClass ) { if ( destClass . isPrimitive ( ) ) { return getPrimitivePromotionCost ( srcClass , destClass ) ; } float cost = 0.0f ; while ( srcClass != null && ! destClass . equals ( srcClass ) ) { if ( destClass . isInterface ( ) && ClassUtils . isAssignable ( srcClass , destClass ) ) { // slight penalty for interface match. // we still want an exact match to override an interface match, // but // an interface match should override anything where we have to // get a superclass. cost += 0.25f ; break ; } cost ++ ; srcClass = srcClass . getSuperclass ( ) ; } /*
     * If the destination class is null, we've traveled all the way up to
     * an Object match. We'll penalize this by adding 1.5 to the cost.
     */ if ( srcClass == null ) { cost += 1.5f ; } return cost ; }
Gets the number of steps required needed to turn the source class into the destination class.
This represents the number of steps in the object hierarchy graph.

@param srcClass The source class
@param destClass The destination class
@return The cost of transforming an object
Gets the number of steps required needed to turn the source class into the destination class . This represents the number of steps in the object hierarchy graph .