@Override
  public int compare(Object o1, Object o2) {
    if (o1 instanceof CachedDeserializable) {
      o1 = ((CachedDeserializable) o1).getDeserializedForReading();
    }

    if (o2 instanceof CachedDeserializable) {
      o2 = ((CachedDeserializable) o2).getDeserializedForReading();
    }

    return comparator.compare(o1, o2);

  }
Compare two cached deserializable objects by unwrapping the underlying object.

If either object is not a cached deserializable, just use the object directly.
geode-core/src/main/java/org/apache/geode/internal/cache/persistence/query/mock/CachedDeserializableComparator.java