public int compareTo(final ComparableNumber o) {
    if (number.getClass().equals(o.getNumber().getClass())) {
      return ((Comparable) number).compareTo((Comparable) o.getNumber());
    } else {
      return new Double(number.doubleValue()).compareTo(o.getNumber().doubleValue());
    }
  }