Interface NumericExpression<T,N extends Number & Comparable<N>>
- Type Parameters:
T- entity type.N- expression type.
- All Superinterfaces:
ComparableExpression<T,,N> Expression<T,N>
- All Known Subinterfaces:
NumericAttribute<T,,N> NumericCast<T,,N> NumericFunctionExpression<T,,N> NumericLiteral<N>,NumericOperatorExpression<T,,N> NumericPath<T,U, N>
An expression that evaluates to a numeric typed value.
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 TypeMethodDescriptiondefault NumericExpression<T, N> abs()Represents the absolute value function applied to the value to which the current expression evaluates.default NumericExpression<T, BigDecimal> Represents the cast function that converts the value to which the current expression evaluates toBigDecimal.default NumericExpression<T, BigInteger> Represents the cast function that converts the value to which the current expression evaluates toBigInteger.default NumericExpression<T, Double> asDouble()Represents the cast function that converts the value to which the current expression evaluates toDouble.default NumericExpression<T, Long> asLong()Represents the cast function that converts the value to which the current expression evaluates toLong.default NumericExpression<T, N> dividedBy(NumericExpression<? super T, N> divisorExpression) Represents the division function that computes the quotient of the value to which the current expression evaluates divided by the value to which the divisor expression evaluates.default NumericExpression<T, N> Represents the division function that computes the quotient of the value to which the current expression evaluates divided by the given divisor value.default NumericExpression<T, N> dividedInto(N value) Represents the division function that computes the quotient of the given value divided by the value to which the current expression evaluates.default NumericExpression<T, N> minus(NumericExpression<? super T, N> expression) Represents the subtraction function that computes the difference of the value to which the current expression evaluates minus the value to which the given expression evaluates.default NumericExpression<T, N> Represents the subtraction function that computes the difference of the value to which the current expression evaluates minus the given value.default NumericExpression<T, N> negated()Represents the sign negation function applied to the value to which the current expression evaluates.default NumericExpression<T, N> plus(NumericExpression<? super T, N> expression) Represents the addition function that computes the sum of the values to which the current expression and the given expression evaluate.default NumericExpression<T, N> Represents the addition function that computes the sum of the value to which the current expression evaluates plus the given value.default NumericExpression<T, N> subtractedFrom(N value) Represents the subtraction function that computes the difference of the given value minus the value to which the current expression evaluates.default NumericExpression<T, N> times(NumericExpression<? super T, N> factorExpression) Represents the multiplication function that computes the product of the values to which the current expression and the given factor expression evaluate.default NumericExpression<T, N> Represents the multiplication function that computes the product of the value to which the current expression evaluates times the given factor.Methods inherited from interface jakarta.data.expression.ComparableExpression
between, between, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, lessThan, lessThan, lessThanEqual, lessThanEqual, notBetween, notBetweenMethods inherited from interface jakarta.data.expression.Expression
equalTo, equalTo, in, in, in, isNull, notEqualTo, notEqualTo, notIn, notIn, notIn, notNull, satisfies, type
-
Method Details
-
abs
Represents the absolute value function applied to the value to which the current expression evaluates.
Example:
within2YearsOf2024 = cars.search(make, model, _Car.year.minus(2024).abs().lessThanEqual(2));- Returns:
- an expression for the function that computes the absolute value.
-
negated
Represents the sign negation function applied to the value to which the current expression evaluates. The sign negation function reverse the sign (positive to negative or negative to positive) of the value. It has no effect on the value
0.Example:
atLeast2YearsBeyondOriginalModelYear = cars.search( make, model, _Car.firstModelYear.minus(_Car.year).negated().greaterThanEqual(2));- Returns:
- an expression for the function that computes negation of value.
-
plus
Represents the addition function that computes the sum of the value to which the current expression evaluates plus the given value.
Example:
found = cars.search(make, model, _Car.price.plus(fees).lessThan(30000));- Parameters:
value- the value to add. Must not benull.- Returns:
- an expression for the function that computes the sum.
- Throws:
NullPointerException- if the supplied value is null.
-
minus
Represents the subtraction function that computes the difference of the value to which the current expression evaluates minus the given value.
Example:
found = cars.search(make, model, _Car.price.minus(discount).lessThanEqual(25000));- Parameters:
value- the value to subtract. Must not benull.- Returns:
- an expression for the function that computes the difference.
- Throws:
NullPointerException- if the supplied value is null.
-
subtractedFrom
Represents the subtraction function that computes the difference of the given value minus the value to which the current expression evaluates.
Example:
found = cars.search( make, model, _Car.price.asDouble().times(_Car.discountRate.subtractedFrom(1.0)) .lessThanEqual(33000.0));- Parameters:
value- the value to subtract from. Must not benull.- Returns:
- an expression for the function that computes the difference.
- Throws:
NullPointerException- if the supplied value is null.
-
dividedInto
Represents the division function that computes the quotient of the given value divided by the value to which the current expression evaluates.
- Parameters:
value- the value to divide into. Must not benull.- Returns:
- an expression for the function that computes the quotient.
- Throws:
NullPointerException- if the supplied value is null.
-
times
Represents the multiplication function that computes the product of the value to which the current expression evaluates times the given factor.
Example:
found = cars.search( make, model, _Car.price.asDouble().times(1.0 + taxRate).lessThan(35000.0));- Parameters:
factor- the value times which to multiply. Must not benull.- Returns:
- an expression for the function that computes the product.
- Throws:
NullPointerException- if the supplied factor value is null.
-
dividedBy
Represents the division function that computes the quotient of the value to which the current expression evaluates divided by the given divisor value.
Example:
found = cars.search( make, model, _Car.price.asDouble().dividedBy(1.0 + discountRate).lessThan(27000.0));- Parameters:
divisor- the value by which to divide. Must not be0ornull.- Returns:
- an expression for the function that computes the quotient.
- Throws:
NullPointerException- if the supplied divisor value is null.
-
plus
Represents the addition function that computes the sum of the values to which the current expression and the given expression evaluate.
Example:
found = cars.search( make, model, _Car.price.plus(_Car.price.times(percentTax).dividedBy(100)) .lessThan(32000));- Parameters:
expression- expression that evaluates to the value to add. Must not benull.- Returns:
- an expression for the function that computes the sum.
- Throws:
NullPointerException- if the supplied value is null.
-
minus
Represents the subtraction function that computes the difference of the value to which the current expression evaluates minus the value to which the given expression evaluates.
Example:
found = cars.search(make, model, _Car.year.minus(_Car.firstModelYear).greaterThan(1));- Parameters:
expression- expression that evaluates to the value to subtract. Must not benull.- Returns:
- an expression for the function that computes the difference.
- Throws:
NullPointerException- if the supplied expression is null.
-
times
Represents the multiplication function that computes the product of the values to which the current expression and the given factor expression evaluate.
Example:
discountedMoreThan2000 = cars.search( make, model, _Car.price.asDouble().times(_Car.discountRate).greaterThan(2000.0));- Parameters:
factorExpression- expression that evaluates to the value by which to multiply. Must not benull.- Returns:
- an expression for the function that computes the product.
- Throws:
NullPointerException- if the supplied factor expression is null.
-
dividedBy
Represents the division function that computes the quotient of the value to which the current expression evaluates divided by the value to which the divisor expression evaluates.
Example:
pricedUnder95PercentWithRebate = cars.search( make, model, _Car.price.minus(rebate).times(100).dividedBy(_Car.price).lessThan(95));- Parameters:
divisorExpression- expression that evaluates to the value by which to divide. Must not benull.- Returns:
- an expression for the function that computes the quotient.
- Throws:
NullPointerException- if the supplied divisor expression is null.
-
asLong
Represents the cast function that converts the value to which the current expression evaluates to
Long.Example:
found = cars.search(make, model, _Car.price.asLong().lessThan(36000L));- Returns:
- an expression for the function that casts to
Long.
-
asDouble
Represents the cast function that converts the value to which the current expression evaluates to
Double.Example:
found = cars.search(make, model, _Car.price.asDouble().lessThan(34000.0));- Returns:
- an expression for the function that casts to
Double.
-
asBigInteger
Represents the cast function that converts the value to which the current expression evaluates to
BigInteger.Example:
found = cars.search(make, model, _Car.price.asBigInteger().lessThan(BigInteger.valueOf(50000L)));- Returns:
- an expression for the function that casts to
BigInteger.
-
asBigDecimal
Represents the cast function that converts the value to which the current expression evaluates to
BigDecimal.Example:
found = cars.search(make, model, _Car.price.asBigDecimal().lessThan(BigDecimal.valueOf(45000L)));- Returns:
- an expression for the function that casts to
BigDecimal.
-