Class Sort
java.lang.Object
com.blazebit.persistence.deltaspike.data.Sort
- All Implemented Interfaces:
Serializable,Iterable<Sort.Order>
public class Sort extends Object implements Iterable<Sort.Order>, Serializable
Immutable container for sorting information, heavily inspired by Spring Data's
Sort.- Since:
- 1.2.0
- Author:
- Christian Beikov
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSort.DirectionSort directions.static classSort.NullHandlingEnumeration for null handling of anSort.Order.static classSort.OrderPropertyPath implements the pairing of anSort.Directionand a property. -
Constructor Summary
Constructors Constructor Description Sort(Sort.Direction direction, String... paths)Creates a new Sort with the given paths the given direction.Sort(Sort.Direction direction, List<String> paths)Creates a new Sort with the given paths and given direction.Sort(Sort.Order... orders)Creates a new Sort with the givenSort.Orders.Sort(String... paths)Creates a new Sort with the given paths and theSort.Direction.ASC.Sort(Collection<Sort.Order> orders)Creates a new Sort with the givenSort.Orders. -
Method Summary
Modifier and Type Method Description Sortand(Sort sort)booleanequals(Object obj)Sort.OrdergetOrderFor(String path)Returns the order for the given path ornullif there is none.inthashCode()Iterator<Sort.Order>iterator()StringtoString()
-
Constructor Details
-
Sort
Creates a new Sort with the givenSort.Orders.- Parameters:
orders- The orders to use for sorting
-
Sort
Creates a new Sort with the givenSort.Orders.- Parameters:
orders- The orders to use for sorting
-
Sort
Creates a new Sort with the given paths and theSort.Direction.ASC.- Parameters:
paths- The paths by which to sort
-
Sort
Creates a new Sort with the given paths the given direction.- Parameters:
direction- The direction to use for sortingpaths- The paths by which to sort
-
Sort
Creates a new Sort with the given paths and given direction.- Parameters:
direction- The direction to use for sortingpaths- The paths by which to sort
-
-
Method Details
-
and
- Parameters:
sort- The other sort, may be null- Returns:
- A new Sort with the union of this and the
Sort.Orders of the givenSort
-
getOrderFor
Returns the order for the given path ornullif there is none.- Parameters:
path- The path for which to get theSort.Order- Returns:
- The
Sort.Orderfor the given path ornullit there is none
-
iterator
- Specified by:
iteratorin interfaceIterable<Sort.Order>
-
equals
-
hashCode
public int hashCode() -
toString
-