Module jpastreamer.field
Interface FieldComparator<ENTITY>
- Type Parameters:
ENTITY- the entity type
- All Superinterfaces:
Comparator<ENTITY>
- All Known Subinterfaces:
BooleanField<ENTITY>,BooleanFieldComparator<ENTITY>,ByteField<ENTITY>,ByteFieldComparator<ENTITY>,CharField<ENTITY>,CharFieldComparator<ENTITY>,DoubleField<ENTITY>,DoubleFieldComparator<ENTITY>,FloatField<ENTITY>,FloatFieldComparator<ENTITY>,IntField<ENTITY>,IntFieldComparator<ENTITY>,LongField<ENTITY>,LongFieldComparator<ENTITY>,ReferenceFieldComparator<ENTITY,,V> ShortField<ENTITY>,ShortFieldComparator<ENTITY>
A specialized
Comparator that contains meta data information about
the field that is being compared.
Implementations of this interface are immutable. Equality is based upon the
equality of the field-identifier, the
null strategy and the order.
- Since:
- 3.0.2
- Author:
- Emil Forslund
-
Method Summary
Modifier and TypeMethodDescriptiongetField()Returns the field that created this comparator.Returns the strategy used whennullvalues are encountered.booleanReturnstrueif this comparator reverses the natural order of the values in the current field.reversed()Returns a newFieldComparatorthat order entities in the opposite orders compared to this comparator.Methods inherited from interface java.util.Comparator
compare, equals, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
getField
Returns the field that created this comparator.- Returns:
- the field
-
getNullOrder
NullOrder getNullOrder()Returns the strategy used whennullvalues are encountered. If the orderNullOrder.NONEis specified, then no guarantees will be made regarding the order of entities where the field value isnull.- Returns:
- the null order strategy
-
isReversed
boolean isReversed()Returnstrueif this comparator reverses the natural order of the values in the current field. A reversed order descends from high values to low.- Returns:
trueif reversed (descending), elsefalse
-
reversed
FieldComparator<ENTITY> reversed()Returns a newFieldComparatorthat order entities in the opposite orders compared to this comparator. For an example, if this comparator orders entities based on a column 'firstname' in descending order, then the returnedFieldComparatorwill be ordering entities based on 'firstname' in ascending order.- Specified by:
reversedin interfaceComparator<ENTITY>- Returns:
- a new reverse comparator
-