Spring Data Commons

org.springframework.data.repository.query.parser
Class OrderBySource

java.lang.Object
  extended by org.springframework.data.repository.query.parser.OrderBySource

public class OrderBySource
extends Object

Simple helper class to create a Sort instance from a method name end. It expects the last part of the method name to be given and supports lining up multiple properties ending with the sorting direction. So the following method ends are valid: LastnameUsernameDesc, LastnameAscUsernameDesc.

Author:
Oliver Gierke

Constructor Summary
OrderBySource(String clause)
          Creates a new OrderBySource for the given String clause not doing any checks whether the referenced property actually exists.
OrderBySource(String clause, Class<?> domainClass)
          Creates a new OrderBySource for the given clause, checking the property referenced exists on the given type.
 
Method Summary
 Sort toSort()
          Returns the clause as Sort.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrderBySource

public OrderBySource(String clause)
Creates a new OrderBySource for the given String clause not doing any checks whether the referenced property actually exists.

Parameters:
clause - must not be null.

OrderBySource

public OrderBySource(String clause,
                     Class<?> domainClass)
Creates a new OrderBySource for the given clause, checking the property referenced exists on the given type.

Parameters:
clause - must not be null.
domainClass -
Method Detail

toSort

public Sort toSort()
Returns the clause as Sort.

Returns:
the Sort or null if no orders found.

toString

public String toString()
Overrides:
toString in class Object

Spring Data Commons

Copyright © 2012. All Rights Reserved.