Spring Data Jpa

org.springframework.data.jpa.domain
Class Specifications<T>

java.lang.Object
  extended by org.springframework.data.jpa.domain.Specifications<T>
All Implemented Interfaces:
Specification<T>

public class Specifications<T>
extends Object
implements Specification<T>

Helper class to easily combine Specification instances.

Author:
Oliver Gierke

Method Summary
 Specifications<T> and(Specification<T> other)
          ANDs the given Specification to the current one.
static
<T> Specifications<T>
not(Specification<T> spec)
          Negates the given Specification.
 Specifications<T> or(Specification<T> other)
          ORs the given specification to the current one.
 javax.persistence.criteria.Predicate toPredicate(javax.persistence.criteria.Root<T> root, javax.persistence.criteria.CriteriaQuery<?> query, javax.persistence.criteria.CriteriaBuilder builder)
          Creates a WHERE clause for a query of the referenced entity in form of a Predicate for the given Root and CriteriaQuery.
static
<T> Specifications<T>
where(Specification<T> spec)
          Simple static factory method to add some syntactic sugar around a Specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

where

public static <T> Specifications<T> where(Specification<T> spec)
Simple static factory method to add some syntactic sugar around a Specification.

Type Parameters:
T -
Parameters:
spec -
Returns:

and

public Specifications<T> and(Specification<T> other)
ANDs the given Specification to the current one.

Parameters:
other -
Returns:

or

public Specifications<T> or(Specification<T> other)
ORs the given specification to the current one.

Parameters:
other -
Returns:

not

public static <T> Specifications<T> not(Specification<T> spec)
Negates the given Specification.

Type Parameters:
T -
Parameters:
spec -
Returns:

toPredicate

public javax.persistence.criteria.Predicate toPredicate(javax.persistence.criteria.Root<T> root,
                                                        javax.persistence.criteria.CriteriaQuery<?> query,
                                                        javax.persistence.criteria.CriteriaBuilder builder)
Description copied from interface: Specification
Creates a WHERE clause for a query of the referenced entity in form of a Predicate for the given Root and CriteriaQuery.

Specified by:
toPredicate in interface Specification<T>
Returns:
a Predicate, must not be null.

Spring Data Jpa

Copyright © 2011-2012 SpringSource. All Rights Reserved.