@SuppressWarnings("unchecked") @Override public int compare(Object aObj, Object bObj) { if (aObj == bObj) { return 0; } StorageDataType ta = getType(aObj); StorageDataType tb = getType(bObj); if (ta != this || tb != this) { if (ta == tb) { return ta.compare(aObj, bObj); } } // TODO ensure comparable type (both may be comparable but not // with each other) if (aObj instanceof Comparable) { if (aObj.getClass().isAssignableFrom(bObj.getClass())) { return ((Comparable<Object>) aObj).compareTo(bObj); } } if (bObj instanceof Comparable) { if (bObj.getClass().isAssignableFrom(aObj.getClass())) { return -((Comparable<Object>) bObj).compareTo(aObj); } } byte[] a = serialize(aObj); byte[] b = serialize(bObj); return ObjectDataType.compareNotNull(a, b); }
byte[] a = (byte[]) aObj; byte[] b = (byte[]) bObj; return ObjectDataType.compareNotNull(a, b);