Create a Java class that is only comparable to itself

In Java 5 and above, how to create a Java class that is only comparable to itself? The answer is to extend Comparable<TheClass>. This works even if TheClass uses generics.

public class SelfComparableOnly<T> implements Comparable<SelfComparableOnly<T>> {    ...    public int compareTo(SelfComparableOnly<T> o) {	// Compare itself to o    }    ...}