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>

public interface FieldComparator<ENTITY> extends Comparator<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 Details

    • getField

      Field<ENTITY> getField()
      Returns the field that created this comparator.
      Returns:
      the field
    • getNullOrder

      NullOrder getNullOrder()
      Returns the strategy used when null values are encountered. If the order NullOrder.NONE is specified, then no guarantees will be made regarding the order of entities where the field value is null.
      Returns:
      the null order strategy
    • isReversed

      boolean isReversed()
      Returns true if this comparator reverses the natural order of the values in the current field. A reversed order descends from high values to low.
      Returns:
      true if reversed (descending), else false
    • reversed

      FieldComparator<ENTITY> reversed()
      Returns a new FieldComparator that 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 returned FieldComparator will be ordering entities based on 'firstname' in ascending order.
      Specified by:
      reversed in interface Comparator<ENTITY>
      Returns:
      a new reverse comparator