Record Class NaturalFieldSort

java.lang.Object
java.lang.Record
com.atlassian.jira.search.NaturalFieldSort
Record Components:
field - the name of the field to sort
order - the sort order i.e. ascending/descending
sortMissingValuesLast - if true, documents that are missing the sort field will appear last on ascending order, and mirrored (i.e. first) on descending order.

If false then it will be the opposite.

All Implemented Interfaces:
FieldSort

@PublicApi public record NaturalFieldSort(String field, FieldSort.Order order, boolean sortMissingValuesLast) extends Record implements FieldSort
Default implementation of FieldSort for natural sorting.

This replaces StringSortComparatorSource and LongSortComparatorSource.

Since:
10.4
  • Constructor Details

    • NaturalFieldSort

      public NaturalFieldSort(String field, FieldSort.Order order)
    • NaturalFieldSort

      public NaturalFieldSort(String field, FieldSort.Order order, boolean sortMissingValuesLast)
      Creates an instance of a NaturalFieldSort record class.
      Parameters:
      field - the value for the field record component
      order - the value for the order record component
      sortMissingValuesLast - the value for the sortMissingValuesLast record component
  • Method Details

    • reverse

      public NaturalFieldSort reverse()
      Specified by:
      reverse in interface FieldSort
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • field

      public String field()
      Returns the value of the field record component.
      Specified by:
      field in interface FieldSort
      Returns:
      the value of the field record component
    • order

      public FieldSort.Order order()
      Returns the value of the order record component.
      Specified by:
      order in interface FieldSort
      Returns:
      the value of the order record component
    • sortMissingValuesLast

      public boolean sortMissingValuesLast()
      Returns the value of the sortMissingValuesLast record component.
      Returns:
      the value of the sortMissingValuesLast record component