static Class<?> comparableClassFor(Object x) {
    if (x instanceof Comparable) {
      Class<?> c;
      Type[] ts, as;
      Type t;
      ParameterizedType p;
      if ((c = x.getClass()) == String.class) // bypass checks
      {
        return c;
      }
      if ((ts = c.getGenericInterfaces()) != null) {
        for (final Type type : ts) {
          if (((t = type) instanceof ParameterizedType)
              && ((p = (ParameterizedType) t).getRawType() == Comparable.class)
              && (as = p.getActualTypeArguments()) != null && as.length == 1 && as[0] == c) // type
          // arg
          // is c
          {
            return c;
          }
        }
      }
    }
    return null;
  }
Returns x's Class if it is of the form "class C implements Comparable<C>", else null.
geode-core/src/main/java/org/apache/geode/internal/concurrent/CompactConcurrentHashSet2.java