Class SortKey


  • public final class SortKey
    extends Object
    A sort key which can be used to specify the order in which connector objects should be included in the results of a search request.
    Since:
    1.4
    Author:
    Laszlo Hordos
    • Constructor Detail

      • SortKey

        public SortKey​(String field,
                       boolean isAscendingOrder)
    • Method Detail

      • ascendingOrder

        public static SortKey ascendingOrder​(String field)
        Creates a new ascending-order sort key for the provided field.
        Parameters:
        field - The sort key field.
        Returns:
        A new ascending-order sort key.
        Throws:
        IllegalArgumentException - If field is not a valid attribute name.
      • descendingOrder

        public static SortKey descendingOrder​(String field)
        Creates a new descending-order sort key for the provided field.
        Parameters:
        field - The sort key field.
        Returns:
        A new descending-order sort key.
        Throws:
        IllegalArgumentException - If field is not a valid attribute name.
      • reverseOrder

        public static SortKey reverseOrder​(SortKey key)
        Creates a new sort key having the same field as the provided key, but in reverse sort order.
        Parameters:
        key - The sort key to be reversed.
        Returns:
        The reversed sort key.
      • getField

        public String getField()
        Returns the sort key field.
        Returns:
        The sort key field.
      • isAscendingOrder

        public boolean isAscendingOrder()
        Returns true if this sort key is in ascending order, or false if it is in descending order.
        Returns:
        true if this sort key is in ascending order, or false if it is in descending ord)er.
      • toString

        public String toString()
        Returns the string representation of this sort key. It will be composed of a plus symbol, if the key is ascending, or a minus symbol, if the key is descending, followed by the field name.
        Overrides:
        toString in class Object
        Returns:
        The string representation of this sort key.