Top Description Methods
jakarta.persistence.criteria

public Interface Expression<T>

extends Selection<T>
Known Direct Subinterfaces
jakarta.persistence.criteria.ParameterExpression, jakarta.persistence.criteria.Path, jakarta.persistence.criteria.Predicate, jakarta.persistence.criteria.Subquery, jakarta.persistence.criteria.CriteriaBuilder.Coalesce, jakarta.persistence.criteria.CriteriaBuilder.SimpleCase, jakarta.persistence.criteria.CriteriaBuilder.Case
Type Parameters
<T>
the type of the expression
Imports
java.util.Collection

Type for query expressions.
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public <X> Expression<X>

Returns:

new expression of the given type
as
(Class<X>
intended type of the expression
type
)

Perform a typecast upon the expression, returning a new expression object.

public <X> Expression<X>

Returns:

a scalar expression of the given basic type
cast
(Class<X>
a basic type
type
)

Cast this expression to the specified type, returning a new expression object.

public Predicate

Returns:

predicate testing for equality
equalTo
(Expression<?>
expression to be tested against
value
)

Create a predicate to test whether the expression is equal to the argument.

public Predicate

Returns:

predicate testing for equality
equalTo
(Object
value to be tested against
value
)

Create a predicate to test whether the expression is equal to the argument.

public Predicate

Returns:

predicate testing for membership
in
(Object...
values to be tested against
values
)

Create a predicate to test whether the expression is a member of the argument list.

public Predicate

Returns:

predicate testing for membership
in
(Expression<?>...
expressions to be tested against
values
)

Create a predicate to test whether the expression is a member of the argument list.

public Predicate

Returns:

predicate testing for membership
in
(Collection<?>
collection of values to be tested against
values
)

Create a predicate to test whether the expression is a member of the collection.

public Predicate

Returns:

predicate testing for membership
in
(Expression<Collection<?>>
expression corresponding to collection to be tested against
values
)

Create a predicate to test whether the expression is a member of the collection.

public Predicate

Returns:

predicate testing whether the expression is not null
isNotNull
()

Create a predicate to test whether the expression is not null.

public Predicate

Returns:

predicate testing whether the expression is null
isNull
()

Create a predicate to test whether the expression is null.

public Predicate

Returns:

predicate testing for inequality
notEqualTo
(Expression<?>
expression to be tested against
value
)

Create a predicate to test whether the expression is unequal to the argument.

public Predicate

Returns:

predicate testing for inequality
notEqualTo
(Object
value to be tested against
value
)

Create a predicate to test whether the expression is unequal to the argument.

Inherited from jakarta.persistence.criteria.Selection:
aliasgetCompoundSelectionItemsisCompoundSelection

Method Detail

asback to summary
public <X> Expression<X> as(Class<X> type)

Perform a typecast upon the expression, returning a new expression object. Unlike cast(Class), this method does not cause type conversion: the runtime type is not changed.

Warning

may result in a runtime failure.

Parameters
type:Class<X>

intended type of the expression

Returns:Expression<X>

new expression of the given type

See Also
cast(Class)
castback to summary
public <X> Expression<X> cast(Class<X> type)

Cast this expression to the specified type, returning a new expression object. Unlike as(Class), this method does result in a runtime type conversion.

Providers are required to support casting scalar expressions to String, and String expressions to Integer, Long, Float, and Double. Support for typecasts between other basic types is not required.

Parameters
type:Class<X>

a basic type

Returns:Expression<X>

a scalar expression of the given basic type

Since
3.2
equalToback to summary
public Predicate equalTo(Expression<?> value)

Create a predicate to test whether the expression is equal to the argument.

Parameters
value:Expression<?>

expression to be tested against

Returns:Predicate

predicate testing for equality

Since
3.2
equalToback to summary
public Predicate equalTo(Object value)

Create a predicate to test whether the expression is equal to the argument.

Parameters
value:Object

value to be tested against

Returns:Predicate

predicate testing for equality

Since
3.2
inback to summary
public Predicate in(Object... values)

Create a predicate to test whether the expression is a member of the argument list.

Parameters
values:Object[]

values to be tested against

Returns:Predicate

predicate testing for membership

inback to summary
public Predicate in(Expression<?>... values)

Create a predicate to test whether the expression is a member of the argument list.

Parameters
values:Expression<?>[]

expressions to be tested against

Returns:Predicate

predicate testing for membership

inback to summary
public Predicate in(Collection<?> values)

Create a predicate to test whether the expression is a member of the collection.

Parameters
values:Collection<?>

collection of values to be tested against

Returns:Predicate

predicate testing for membership

inback to summary
public Predicate in(Expression<Collection<?>> values)

Create a predicate to test whether the expression is a member of the collection.

Parameters
values:Expression<Collection<?>>

expression corresponding to collection to be tested against

Returns:Predicate

predicate testing for membership

isNotNullback to summary
public Predicate isNotNull()

Create a predicate to test whether the expression is not null.

Returns:Predicate

predicate testing whether the expression is not null

isNullback to summary
public Predicate isNull()

Create a predicate to test whether the expression is null.

Returns:Predicate

predicate testing whether the expression is null

notEqualToback to summary
public Predicate notEqualTo(Expression<?> value)

Create a predicate to test whether the expression is unequal to the argument.

Parameters
value:Expression<?>

expression to be tested against

Returns:Predicate

predicate testing for inequality

Since
3.2
notEqualToback to summary
public Predicate notEqualTo(Object value)

Create a predicate to test whether the expression is unequal to the argument.

Parameters
value:Object

value to be tested against

Returns:Predicate

predicate testing for inequality

Since
3.2