ObjectDB ObjectDB

javax.persistence.criteria.Predicate - JPA interface

javax.persistence.criteria
Interface Predicate

Superinterfaces:
Expression<Boolean>, Selection<Boolean>, TupleElement<Boolean>
Subinterfaces:
In
The type of a simple or compound predicate: a conjunction or disjunction of restrictions. A simple predicate is considered to be a conjunction with a single conjunct.
Since:
JPA 2.0
Learn how to use JPA Criteria API's Predicate in Chapter 4 of the ObjectDB/JPA manual.
Selection<X> alias(String name)
Assigns an alias to the selection item.
Assigns an alias to the selection item. Once assigned, an alias cannot be changed or reassigned. Returns the same selection item.
Parameters:
name - alias
Returns:
selection item
Since:
JPA 2.0
Expression<X> as(Class<X> type)
Perform a typecast upon the expression, returning a new expression object.
Perform a typecast upon the expression, returning a new expression object. This method does not cause type conversion: the runtime type is not changed. Warning: may result in a runtime failure.
Parameters:
type - intended type of the expression
Returns:
new expression of the given type
Since:
JPA 2.0
String getAlias()
Return the alias assigned to the tuple element or null, if no alias has been assigned.
Return the alias assigned to the tuple element or null, if no alias has been assigned.
Returns:
alias
Since:
JPA 2.0
Return the selection items composing a compound selection.
Return the selection items composing a compound selection. Modifications to the list do not affect the query.
Returns:
list of selection items
Throws:
IllegalStateException - if selection is not a compound selection
Since:
JPA 2.0
Return the top-level conjuncts or disjuncts of the predicate.
Return the top-level conjuncts or disjuncts of the predicate. Returns empty list if there are no top-level conjuncts or disjuncts of the predicate. Modifications to the list do not affect the query.
Returns:
list of boolean expressions forming the predicate
Since:
JPA 2.0
Class<?> getJavaType()
Return the Java type of the tuple element.
Return the Java type of the tuple element.
Returns:
the Java type of the tuple element
Since:
JPA 2.0
Return the boolean operator for the predicate.
Return the boolean operator for the predicate. If the predicate is simple, this is AND.
Returns:
boolean operator for the predicate
Since:
JPA 2.0
Predicate in(Object... values)
Create a predicate to test whether the expression is a member of the argument list.
Create a predicate to test whether the expression is a member of the argument list.
Parameters:
values - values to be tested against
Returns:
predicate testing for membership
Since:
JPA 2.0
Predicate in(Collection<?> values)
Create a predicate to test whether the expression is a member of the collection.
Create a predicate to test whether the expression is a member of the collection.
Parameters:
values - collection of values to be tested against
Returns:
predicate testing for membership
Since:
JPA 2.0
Create a predicate to test whether the expression is a member of the collection.
Create a predicate to test whether the expression is a member of the collection.
Parameters:
values - expression corresponding to collection to be tested against
Returns:
predicate testing for membership
Since:
JPA 2.0
Create a predicate to test whether the expression is a member of the argument list.
Create a predicate to test whether the expression is a member of the argument list.
Parameters:
values - expressions to be tested against
Returns:
predicate testing for membership
Since:
JPA 2.0
Whether the selection item is a compound selection.
Whether the selection item is a compound selection.
Returns:
boolean indicating whether the selection is a compound selection
Since:
JPA 2.0
boolean isNegated()
Whether the predicate has been created from another predicate by applying the Predicate.not() method or the CriteriaBuilder.not() method.
Whether the predicate has been created from another predicate by applying the Predicate.not() method or the CriteriaBuilder.not() method.
Returns:
boolean indicating if the predicate is a negated predicate
Since:
JPA 2.0
Create a predicate to test whether the expression is not null.
Create a predicate to test whether the expression is not null.
Returns:
predicate testing whether the expression is not null
Since:
JPA 2.0
Create a predicate to test whether the expression is null.
Create a predicate to test whether the expression is null.
Returns:
predicate testing whether the expression is null
Since:
JPA 2.0
Create a negation of the predicate.
Create a negation of the predicate.
Returns:
negated predicate
Since:
JPA 2.0