org.synyx.hades.domain
Class Sort

java.lang.Object
  extended by org.synyx.hades.domain.Sort
All Implemented Interfaces:
java.lang.Iterable<Sort.Property>

public class Sort
extends java.lang.Object
implements java.lang.Iterable<Sort.Property>

Sort option for queries. You have to provide at least a list of properties to sort for that must not include null or empty strings. The order defaults to .

Author:
Oliver Gierke - gierke@synyx.de

Nested Class Summary
static class Sort.Property
          Property implements the pairing of an Order and a property.
 
Field Summary
static Order DEFAULT_ORDER
           
 
Constructor Summary
Sort(java.util.List<Sort.Property> properties)
          Creates a new Sort instance.
Sort(Order order, java.lang.String... properties)
          Creates a new Sort instance.
Sort(java.lang.String... properties)
          Creates a new Sort instance.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 Order getOrder()
          Deprecated. use Sort.Property.getOrder() while iterating over all properties
 java.lang.String[] getProperties()
          Deprecated. prefer iterating over the Sort instance
 int hashCode()
           
 boolean isAscending()
          Deprecated. use Sort.Property.isAscending() while iterating over all properties
 java.util.Iterator<Sort.Property> iterator()
           
 Sort with(Order order)
          Deprecated. user Sort.Property.with(Order) instead
 Sort withProperties(java.lang.String... properties)
          Deprecated. use Sort.Property.withProperties(String...) instead
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ORDER

public static final Order DEFAULT_ORDER
Constructor Detail

Sort

public Sort(java.util.List<Sort.Property> properties)
Creates a new Sort instance. Takes a List of Sort.Property

Parameters:
properties - must not be null or contain null or empty strings

Sort

public Sort(java.lang.String... properties)
Creates a new Sort instance. Order defaults to .

Parameters:
properties - must not be null or contain null or empty strings

Sort

public Sort(Order order,
            java.lang.String... properties)
Creates a new Sort instance.

Parameters:
order - defaults to (for null cases, too)
properties - must not be null or contain null or empty strings
Method Detail

getProperties

@Deprecated
public java.lang.String[] getProperties()
Deprecated. prefer iterating over the Sort instance

Returns sort properties.

Returns:
the property

getOrder

@Deprecated
public Order getOrder()
Deprecated. use Sort.Property.getOrder() while iterating over all properties

Returns the sort order.

Returns:
the order

isAscending

@Deprecated
public boolean isAscending()
Deprecated. use Sort.Property.isAscending() while iterating over all properties

Returns whether the sorting should be ascending.

Returns:
whether the sorting should be ascending

with

@Deprecated
public Sort with(Order order)
Deprecated. user Sort.Property.with(Order) instead

Returns a new Sort instance with the given order and the same properties.

Parameters:
order -
Returns:

withProperties

@Deprecated
public Sort withProperties(java.lang.String... properties)
Deprecated. use Sort.Property.withProperties(String...) instead

Returns a new Sort instance with the given properties and the same order.

Parameters:
properties -
Returns:

iterator

public java.util.Iterator<Sort.Property> iterator()
Specified by:
iterator in interface java.lang.Iterable<Sort.Property>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2009-2010 Synyx GmbH & Co. KG. All Rights Reserved.