Spring Data Commons

org.springframework.data.domain
Class Sort.Order

java.lang.Object
  extended by org.springframework.data.domain.Sort.Order
All Implemented Interfaces:
Serializable
Enclosing class:
Sort

public static class Sort.Order
extends Object
implements Serializable

PropertyPath implements the pairing of an Order and a property. It is used to provide input for Sort

Author:
Oliver Gierke
See Also:
Serialized Form

Constructor Summary
Sort.Order(Sort.Direction direction, String property)
          Creates a new Sort.Order instance. if order is null then order defaults to
Sort.Order(String property)
          Creates a new Sort.Order instance.
 
Method Summary
static List<Sort.Order> create(Sort.Direction direction, Iterable<String> properties)
           
 boolean equals(Object obj)
           
 Sort.Direction getDirection()
          Returns the order the property shall be sorted for.
 String getProperty()
          Returns the property to order for.
 int hashCode()
           
 boolean isAscending()
          Returns whether sorting for this property shall be ascending.
 String toString()
           
 Sort.Order with(Sort.Direction order)
          Returns a new Sort.Order with the given Sort.Order.
 Sort withProperties(String... properties)
          Returns a new Sort instance for the given properties.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sort.Order

public Sort.Order(Sort.Direction direction,
                  String property)
Creates a new Sort.Order instance. if order is null then order defaults to

Parameters:
direction - can be null
property - must not be null or empty

Sort.Order

public Sort.Order(String property)
Creates a new Sort.Order instance. Takes a single property. Order defaults to

Parameters:
property - - must not be null or empty
Method Detail

create

public static List<Sort.Order> create(Sort.Direction direction,
                                      Iterable<String> properties)

getDirection

public Sort.Direction getDirection()
Returns the order the property shall be sorted for.

Returns:

getProperty

public String getProperty()
Returns the property to order for.

Returns:

isAscending

public boolean isAscending()
Returns whether sorting for this property shall be ascending.

Returns:

with

public Sort.Order with(Sort.Direction order)
Returns a new Sort.Order with the given Sort.Order.

Parameters:
order -
Returns:

withProperties

public Sort withProperties(String... properties)
Returns a new Sort instance for the given properties.

Parameters:
properties -
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

Spring Data Commons

Copyright © 2012. All Rights Reserved.