Interface SortProperty<R>

Type Parameters:
R - the type of resources (e.g. Feature) to sort.
All Superinterfaces:
Comparator<R>

@UML(identifier="SortProperty", specification=ISO_19143) public interface SortProperty<R> extends Comparator<R>
Defines the sort order of a property.
Since:
3.1
See Also:
  • Method Details

    • getValueReference

      @UML(identifier="valueReference", obligation=MANDATORY, specification=ISO_19143) ValueReference<? super R,?> getValueReference()
      The property to sort by.
      Returns:
      the property to sort by.
    • getSortOrder

      @UML(identifier="sortOrder", obligation=OPTIONAL, specification=ISO_19143) default SortOrder getSortOrder()
      The sorting order, ascending or descending. The default value is ascending order.
      Returns:
      the sorting order.
    • compare

      int compare(R r1, R r2)
      Compares two resources for order. Returns a negative number if r1 should be sorted before r2, a positive number if r2 should be after r1, or 0 if both resources are equal. The ordering of null resources or null property values is unspecified.

      The comparison shall be consistent (ignoring unspecified aspects such as null values) with a comparison done "manually" by fetching the values identified by the value reference from the two resources and comparing them according the sort order. In order words, it shall be possible for the users to build their own SQL (or other language) query using above information and get the same results without invoking this compare(…) method.

      Specified by:
      compare in interface Comparator<R>
      Parameters:
      r1 - the first resource to compare.
      r2 - the second resource to compare.
      Returns:
      negative if the first resource is before the second, positive for the converse, or 0 if equal.
      Throws:
      InvalidFilterValueException - if the expression cannot be applied on the given resources.
      ClassCastException - if the types of property values prevent them from being compared by this comparator.
      See Also: