Spring Data JPA

org.springframework.data.jpa.domain
Class JpaSort

java.lang.Object
  extended by org.springframework.data.domain.Sort
      extended by org.springframework.data.jpa.domain.JpaSort
All Implemented Interfaces:
Serializable, Iterable<Sort.Order>

public class JpaSort
extends Sort

Sort option for queries that wraps JPA meta-model Attributes for sorting.

Author:
Thomas Darimont, Oliver Gierke
See Also:
Serialized Form

Nested Class Summary
static class JpaSort.Path<T,S>
          Value object to abstract a collection of Attributes.
 
Nested classes/interfaces inherited from class org.springframework.data.domain.Sort
Sort.Direction, Sort.Order
 
Field Summary
 
Fields inherited from class org.springframework.data.domain.Sort
DEFAULT_DIRECTION
 
Constructor Summary
JpaSort(javax.persistence.metamodel.Attribute<?,?>... attributes)
          Creates a new JpaSort for the given attributes with the default sort direction.
JpaSort(JpaSort.Path<?,?>... paths)
          Creates a new JpaSort instance with the given JpaSort.Paths.
JpaSort(Sort.Direction direction, javax.persistence.metamodel.Attribute<?,?>... attributes)
          Creates a new JpaSort for the given direction and attributes.
JpaSort(Sort.Direction direction, JpaSort.Path<?,?>... paths)
          Creates a new JpaSort for the given direction and JpaSort.Paths.
 
Method Summary
static
<T,S> JpaSort.Path<T,S>
path(javax.persistence.metamodel.Attribute<T,S> attribute)
          Creates a new JpaSort.Path for the given Attribute.
static
<T,S> JpaSort.Path<T,S>
path(javax.persistence.metamodel.PluralAttribute<T,?,S> attribute)
          Creates a new JpaSort.Path for the given PluralAttribute.
 
Methods inherited from class org.springframework.data.domain.Sort
and, equals, getOrderFor, hashCode, iterator, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JpaSort

public JpaSort(javax.persistence.metamodel.Attribute<?,?>... attributes)
Creates a new JpaSort for the given attributes with the default sort direction.

Parameters:
attributes - must not be null or empty.

JpaSort

public JpaSort(JpaSort.Path<?,?>... paths)
Creates a new JpaSort instance with the given JpaSort.Paths.

Parameters:
paths - must not be null or empty.

JpaSort

public JpaSort(Sort.Direction direction,
               javax.persistence.metamodel.Attribute<?,?>... attributes)
Creates a new JpaSort for the given direction and attributes.

Parameters:
direction - the sorting direction.
attributes - must not be null or empty.

JpaSort

public JpaSort(Sort.Direction direction,
               JpaSort.Path<?,?>... paths)
Creates a new JpaSort for the given direction and JpaSort.Paths.

Parameters:
direction - the sorting direction.
paths - must not be null or empty.
Method Detail

path

public static <T,S> JpaSort.Path<T,S> path(javax.persistence.metamodel.Attribute<T,S> attribute)
Creates a new JpaSort.Path for the given Attribute.

Parameters:
attribute - must not be null.
Returns:

path

public static <T,S> JpaSort.Path<T,S> path(javax.persistence.metamodel.PluralAttribute<T,?,S> attribute)
Creates a new JpaSort.Path for the given PluralAttribute.

Parameters:
attribute - must not be null.
Returns:

Spring Data JPA

Copyright © 2011-2014-2014 Pivotal. All Rights Reserved.