@SuppressWarnings("unchecked")
@Override
public TypeComparator<T> createComparator(boolean sortOrderAscending) {
if (isKeyType()) {
@SuppressWarnings("rawtypes")
GenericTypeComparator comparator = new GenericTypeComparator(sortOrderAscending, createSerializer(), this.typeClass);
return (TypeComparator<T>) comparator;
}
throw new UnsupportedOperationException("Types that do not implement java.lang.Comparable cannot be used as keys.");
}