private static class DMOSorter.FieldWorker extends java.lang.Object implements java.util.Comparator<Persistable>
Modifier and Type | Field and Description |
---|---|
private static BasicSorter<java.lang.Long> |
ASC_PK_SORTER
Ascending primary key sorter
|
private static BasicSorter<java.lang.Long> |
DESC_PK_SORTER
Descending primary key sorter
|
private FieldReference |
field
Accessor object for DMO property
|
private BasicSorter |
sorter
Worker object which performs a sort of DMO property data
|
Constructor and Description |
---|
FieldWorker(Database database,
java.lang.Class<?> dmoIface,
SortCriterion criterion)
Constructor which accepts a DMO type and single property sort
criterion.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Persistable p1,
Persistable p2)
Compare two
Persistable instances to determine relative
sort order, according to the sort criterion specified for this
worker. |
private static final BasicSorter<java.lang.Long> ASC_PK_SORTER
private static final BasicSorter<java.lang.Long> DESC_PK_SORTER
private final BasicSorter sorter
private final FieldReference field
FieldWorker(Database database, java.lang.Class<?> dmoIface, SortCriterion criterion)
database
- The associated database.dmoIface
- DMO type.criterion
- Sort criterion which specifies property and direction of
sort.public int compare(Persistable p1, Persistable p2)
Persistable
instances to determine relative
sort order, according to the sort criterion specified for this
worker. The comparison uses the natural order of the property data,
except that unknown value always sorts high in an ascending sort.
The result is inverted for descending sorts (meaning unknown value
sorts low in a descending sort.compare
in interface java.util.Comparator<Persistable>
p1
- First DMO to compare. Must not be null
.p2
- Second DMO to compare. Must not be null
.p1
> p2
;
negative value if p1
< p2
;
0
if p1
and p2
sort
equivalently.