- 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 Summary
Modifier and TypeMethodDescriptionint
Compares two resources for order.default SortOrder
The sorting order, ascending or descending.ValueReference<? super R,
?> The property to sort by.Methods inherited from interface Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
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
Compares two resources for order. Returns a negative number ifr1
should be sorted beforer2
, a positive number ifr2
should be afterr1
, 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 interfaceComparator<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:
-