Interface ComparableExpression<T,V extends Comparable<?>>
- Type Parameters:
T- entity type.V- expression type.
- All Superinterfaces:
Expression<T,V>
- All Known Subinterfaces:
BooleanAttribute<T>,BooleanExpression<T>,BooleanLiteral,BooleanPath<T,,U> ComparableAttribute<T,,V> ComparableLiteral<V>,ComparablePath<T,,U, C> CurrentDate<T>,CurrentDateTime<T>,CurrentTime<T>,NumericAttribute<T,,N> NumericCast<T,,N> NumericExpression<T,,N> NumericFunctionExpression<T,,N> NumericLiteral<N>,NumericOperatorExpression<T,,N> NumericPath<T,,U, N> StringLiteral,TemporalAttribute<T,,V> TemporalExpression<T,,V> TemporalLiteral<V>,TemporalPath<T,,U, V> TextAttribute<T>,TextExpression<T>,TextFunctionExpression<T>,TextPath<T,U>
- All Known Implementing Classes:
TextAttributeRecord
An expression that evaluates to a comparable result that can be sorted.
A more specific subtype, such as BooleanExpression,
NumericExpression, TemporalExpression, or
TextExpression, should be used instead wherever it is possible.
The entity and static metamodel for the code
examples within this class are shown in the Attribute Javadoc.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptionasc()Obtain a request for an ascendingSortbased on the value to which this expression computes.default <U extends ComparableExpression<? super T,V>>
Restriction<T> between(U minExpression, U maxExpression) Obtains aRestrictionthat requires that this expression evaluate to a value falling within the range between (and inclusive of) the values to which the given expressions evaluate.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value falling within the range between (and inclusive of) the specified values.desc()Obtain a request for a descendingSortbased on the value to which this expression computes.default Restriction<T> greaterThan(ComparableExpression<? super T, V> expression) Obtains aRestrictionthat requires that this expression evaluate to a value greater than the value to which the given expression evaluates.default Restriction<T> greaterThan(V value) Obtains aRestrictionthat requires that this expression evaluate to a value greater than the given value.default Restriction<T> greaterThanEqual(ComparableExpression<? super T, V> expression) Obtains aRestrictionthat requires that this expression evaluate to a value greater than or equal to the value to which the given expression evaluates.default Restriction<T> greaterThanEqual(V value) Obtains aRestrictionthat requires that this expression evaluate to a value greater than or equal to the given value.default Restriction<T> lessThan(ComparableExpression<? super T, V> expression) Obtains aRestrictionthat requires that this expression evaluate to a value smaller than the value to which the given expression evaluates.default Restriction<T> Obtains aRestrictionthat requires that this expression evaluate to a value smaller than the given value.default Restriction<T> lessThanEqual(ComparableExpression<? super T, V> expression) Obtains aRestrictionthat requires that this expression evaluate to a value less than or equal to the value to which the given expression evaluates.default Restriction<T> lessThanEqual(V value) Obtains aRestrictionthat requires that this expression evaluate to a value less than or equal to the given value.default <U extends ComparableExpression<? super T,V>>
Restriction<T> notBetween(U minExpression, U maxExpression) Obtains aRestrictionthat requires that this expression evaluate to a value falling outside the range between the values to which the given expressions evaluate.default Restriction<T> notBetween(V min, V max) Obtains aRestrictionthat requires that this expression evaluate to a value falling outside the range between given values.Methods inherited from interface jakarta.data.expression.Expression
equalTo, equalTo, in, in, in, isNull, notEqualTo, notEqualTo, notIn, notIn, notIn, notNull, satisfies, type
-
Method Details
-
asc
Obtain a request for an ascendingSortbased on the value to which this expression computes.- Returns:
- a request for an ascending sort.
-
between
Obtains a
Restrictionthat requires that this expression evaluate to a value falling within the range between (and inclusive of) the specified values.Example:
found = cars.search(make, model, _Car.year.between(2022, 2025));- Parameters:
min- the lower bound on the range. Must not benull.max- the upper bound on the range. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the value isnull.
-
between
@Nonnull default <U extends ComparableExpression<? super T,V>> Restriction<T> between(@Nonnull U minExpression, @Nonnull U maxExpression) Obtains a
Restrictionthat requires that this expression evaluate to a value falling within the range between (and inclusive of) the values to which the given expressions evaluate.Example:
preOwnedInRangeOfModelYears = cars.search( make, model, _Car.year.between(_Car.firstModelYear.plus(2), _Car.firstModelYear.plus(5)));- Parameters:
minExpression- expression that evaluates to the lower bound on the range. Must not benull.maxExpression- expression that evaluates to the upper bound on the range. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the expression isnull.
-
desc
Obtain a request for a descendingSortbased on the value to which this expression computes.- Returns:
- a request for a descending sort.
-
greaterThan
Obtains a
Restrictionthat requires that this expression evaluate to a value greater than the given value.Example:
found = cars.search(make, model, _Car.price.greaterThan(25000));- Parameters:
value- value against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the value isnull.
-
greaterThan
Obtains a
Restrictionthat requires that this expression evaluate to a value greater than the value to which the given expression evaluates.Example:
found = cars.search(make, model, _Car.year.greaterThan(_Car.firstModelYear));- Parameters:
expression- expression against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the expression isnull.
-
greaterThanEqual
Obtains a
Restrictionthat requires that this expression evaluate to a value greater than or equal to the given value.Example:
atLeast2024 = cars.search(make, model, _Car.year.greaterThanEqual(2024));- Parameters:
value- value against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the value isnull.
-
greaterThanEqual
@Nonnull default Restriction<T> greaterThanEqual(@Nonnull ComparableExpression<? super T, V> expression) Obtains a
Restrictionthat requires that this expression evaluate to a value greater than or equal to the value to which the given expression evaluates.Example:
found = cars.search(make, model, _Car.year.greaterThanEqual(_Car.firstModelYear.plus(2)));- Parameters:
expression- expression against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the expression isnull.
-
lessThan
Obtains a
Restrictionthat requires that this expression evaluate to a value smaller than the given value.Example:
found = cars.search(make, model, _Car.price.lessThan(35000));- Parameters:
value- value against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the value isnull.
-
lessThan
Obtains a
Restrictionthat requires that this expression evaluate to a value smaller than the value to which the given expression evaluates.Example:
listedBeforeToday = cars.search(make, model, _Car.listed.lessThan(CurrentDate.now()));- Parameters:
expression- expression against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the expression isnull.
-
lessThanEqual
Obtains a
Restrictionthat requires that this expression evaluate to a value less than or equal to the given value.Example:
found = cars.search(make, model, _Car.price.lessThanEqual(25000));- Parameters:
value- value against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the value isnull.
-
lessThanEqual
@Nonnull default Restriction<T> lessThanEqual(@Nonnull ComparableExpression<? super T, V> expression) Obtains a
Restrictionthat requires that this expression evaluate to a value less than or equal to the value to which the given expression evaluates.Example:
found = cars.search(make, model, _Car.firstModelYear.lessThanEqual(_Car.year.minus(2)));- Parameters:
expression- expression against which to compare. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the expression isnull.
-
notBetween
Obtains a
Restrictionthat requires that this expression evaluate to a value falling outside the range between given values.Example:
found = cars.search(make, model, _Car.year.notBetween(2021, 2023));- Parameters:
min- the lower bound on the range. Must not benull.max- the upper bound on the range. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the value isnull.
-
notBetween
@Nonnull default <U extends ComparableExpression<? super T,V>> Restriction<T> notBetween(@Nonnull U minExpression, @Nonnull U maxExpression) Obtains a
Restrictionthat requires that this expression evaluate to a value falling outside the range between the values to which the given expressions evaluate.Example:
found = cars.search(make, model, _Car.year.notBetween(_Car.firstModelYear, _Car.firstModelYear.plus(2)));- Parameters:
minExpression- expression that evaluates to the lower bound on the range. Must not benull.maxExpression- expression that evaluates to the lower bound on the range. Must not benull.- Returns:
- the restriction.
- Throws:
NullPointerException- if the expression isnull.
-