summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/synthetic
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2007-10-11 21:00:12 +0000
committerBrian S. O'Neill <bronee@gmail.com>2007-10-11 21:00:12 +0000
commit90bd381e91c873af5956da9e5f0cfa2b29675633 (patch)
treecce0002e09cf9315af243fcdc5b54f654e1780eb /src/main/java/com/amazon/carbonado/synthetic
parent9950a28e33755e95eb2d40dbe3b78108400ce029 (diff)
Support sorting of arrays.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/synthetic')
-rw-r--r--src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java
index f9db620..4fddcd5 100644
--- a/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java
+++ b/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java
@@ -29,6 +29,7 @@ import java.util.Set;
import com.amazon.carbonado.Storable;
import com.amazon.carbonado.SupportException;
+import com.amazon.carbonado.cursor.SortedCursor;
import com.amazon.carbonado.info.Direction;
import com.amazon.carbonado.info.StorableInfo;
import com.amazon.carbonado.info.StorableIntrospector;
@@ -219,18 +220,14 @@ public class SyntheticStorableReferenceBuilder<S extends Storable>
mSyntheticClass = mBuilder.getStorableClass();
// We need a comparator which follows the same order as the generated
- // storable. We can't construct it until we get here
- {
- BeanComparator bc = BeanComparator.forClass(mSyntheticClass);
- Iterator<String> props = mPrimaryKey.getProperties();
- while (props.hasNext()) {
- String prop = props.next();
- // BeanComparator knows how to handle the '+' or '-' prefix.
- bc = bc.orderBy(prop);
- bc = bc.caseSensitive();
- }
- mComparator = bc;
+ // storable. We can't construct it until we get here.
+ String[] orderBy = new String[mPrimaryKey.getPropertyCount()];
+ int i=0;
+ Iterator<String> it = mPrimaryKey.getProperties();
+ while (it.hasNext()) {
+ orderBy[i++] = it.next();
}
+ mComparator = SortedCursor.createComparator(mSyntheticClass, orderBy);
}
return mSyntheticClass;
}