}
private SortField getStringSortField(String fieldName, boolean reverse, boolean nullLast, boolean nullFirst) {
if (nullLast) {
if (!reverse)
return new EmbeddedSortField(fieldName, nullStringLastComparatorSource);
else
return new EmbeddedSortField(fieldName, SortField.STRING, true);
} else if (nullFirst) {
if (reverse)
return new EmbeddedSortField(fieldName, nullStringLastComparatorSource, true);
else
return new EmbeddedSortField(fieldName, SortField.STRING, false);
} else {
return new EmbeddedSortField(fieldName, SortField.STRING, reverse);
}
}