public class TLcdOGCSortBy extends TLcdDataObject implements ILcdOGCSortBy
This class represents the <ogc:SortBy>
element.
The <ogc:SortBy>
element contains a list of properties that must be taken into account for sorting.
comparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
and thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
factory methods.
Example:
TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
Note that while instances of this class are mutable, you should not modify them once in use.Constructor and Description |
---|
TLcdOGCSortBy()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addSortProperty(TLcdOGCSortProperty aSortProperty)
Adds a sort property.
|
java.util.Comparator<java.lang.Object> |
asComparator(TLcdOGCFilterContext aFilterContext)
Builds a comparator that can be used to sort collections of (OGC) features based on this
TLcdOGCSortBy object. |
static TLcdOGCSortBy |
comparing(TLcdOGCPropertyName aPropertyName)
Create a "sort by" based on the given property.
|
static TLcdOGCSortBy |
comparing(TLcdOGCPropertyName aPropertyName,
int aSortOrder)
Create a "sort by" based on the given property.
|
boolean |
equals(java.lang.Object obj) |
java.util.List<TLcdOGCSortProperty> |
getSortProperties()
Returns the list of sort properties.
|
TLcdOGCSortProperty |
getSortProperty(int aIndex)
Gets the sort property at a given position.
|
int |
getSortPropertyCount()
Gets the number of sort properties.
|
int |
hashCode() |
void |
insertSortPropertyAt(TLcdOGCSortProperty aSortProperty,
int aIndex)
Inserts a sort property at a given position.
|
boolean |
removeSortProperty(TLcdOGCSortProperty aSortProperty)
Removes a given sort property.
|
TLcdOGCSortBy |
thenComparing(TLcdOGCPropertyName aPropertyName)
Create a new "sort by" that first sorts using this sort-by,
then on the given property when two elements are considered equal by this sort-by.
|
TLcdOGCSortBy |
thenComparing(TLcdOGCPropertyName aPropertyName,
int aSortOrder)
Create a new "sort by" that first sorts using this sort-by,
then on the given property when two elements are considered equal by this sort-by.
|
java.lang.String |
toString() |
clone, clone, getDataType, getValue, getValue, hasValue, hasValue, setValue, setValue
public TLcdOGCSortBy()
comparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
and thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
factory methods instead of directly instantiating this.
Example:
TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
Note that while instances of this class are mutable, you should not modify them once in use.public void insertSortPropertyAt(TLcdOGCSortProperty aSortProperty, int aIndex)
aSortProperty
- the sort property to be inserted.aIndex
- the index of the given position.public java.util.List<TLcdOGCSortProperty> getSortProperties()
public void addSortProperty(TLcdOGCSortProperty aSortProperty)
aSortProperty
- the sort property to be added.public int getSortPropertyCount()
public boolean removeSortProperty(TLcdOGCSortProperty aSortProperty)
aSortProperty
- the sort property to be removed.public TLcdOGCSortProperty getSortProperty(int aIndex)
aIndex
- the index of the given position.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class TLcdDataObject
public static TLcdOGCSortBy comparing(TLcdOGCPropertyName aPropertyName)
ascending
.
You can sort on multiple properties by chaining with thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
.
Example:
TLcdOGCSortBy sortBy = comparing(property("AGE")).thenComparing(property("NAME"));
aPropertyName
- The property to sort oncomparing with specific sort order
,
thenComparing
public static TLcdOGCSortBy comparing(TLcdOGCPropertyName aPropertyName, int aSortOrder)
thenComparing(com.luciad.ogc.filter.model.TLcdOGCPropertyName)
.
Example:
TLcdOGCSortBy sortBy = comparing(property("AGE"), DESC).thenComparing(property("NAME"));
aPropertyName
- The property name to sort onaSortOrder
- The sorting order, must be ASC
or DESC
.thenComparing
public final TLcdOGCSortBy thenComparing(TLcdOGCPropertyName aPropertyName)
TLcdOGCSortBy sortBy = comparing(property("AGE")).thenComparing(property("NAME"));
aPropertyName
- The property to sort on (ascending
) after sorting on this sort-by.thenComparing with specific sort order
public final TLcdOGCSortBy thenComparing(TLcdOGCPropertyName aPropertyName, int aSortOrder)
TLcdOGCSortBy sortBy = comparing(property("NAME")).thenComparing(property("AGE"), DESC);
aPropertyName
- The property to sort on, if the existing sorting order is indeterminate.public final java.util.Comparator<java.lang.Object> asComparator(TLcdOGCFilterContext aFilterContext)
TLcdOGCSortBy
object.aFilterContext
- the context in which to create the filter. The context defines amongst others how a property is
retrieved from an (OGC) feature.