com.mysema.query.types.expr
Class NumberExpression<T extends Number & Comparable<?>>

java.lang.Object
  extended by com.mysema.query.types.ExpressionBase<T>
      extended by com.mysema.query.types.expr.SimpleExpression<T>
          extended by com.mysema.query.types.expr.ComparableExpressionBase<T>
              extended by com.mysema.query.types.expr.NumberExpression<T>
Type Parameters:
T - expression type
All Implemented Interfaces:
Expression<T>, Serializable
Direct Known Subclasses:
NumberOperation, NumberPath, NumberSubQuery, NumberTemplate, SumOver

public abstract class NumberExpression<T extends Number & Comparable<?>>
extends ComparableExpressionBase<T>

NumberExpression represents a numeric expression

Author:
tiwe
See Also:
Number, Serialized Form

Field Summary
 
Fields inherited from class com.mysema.query.types.expr.SimpleExpression
primitive
 
Fields inherited from class com.mysema.query.types.ExpressionBase
type
 
Constructor Summary
NumberExpression(Class<? extends T> type)
           
 
Method Summary
 NumberExpression<T> abs()
          Get the absolute value of this expression
<N extends Number & Comparable<?>>
NumberExpression<T>
add(Expression<N> right)
          Get the sum of this and right
<N extends Number & Comparable<N>>
NumberExpression<T>
add(N right)
          Get the sum of this and right
 NumberExpression<T> as(Path<T> alias)
          Create an alias for the expression
 NumberExpression<T> as(String alias)
          Create an alias for the expression
 NumberExpression<Double> avg()
          Get the average value of this expression (aggregation)
<A extends Number & Comparable<?>>
BooleanExpression
between(A from, A to)
          Create a from < this < to expression
<A extends Number & Comparable<?>>
BooleanExpression
between(Expression<A> from, Expression<A> to)
          Create a from < this < to expression
 NumberExpression<Byte> byteValue()
          Get the byte expression of this numeric expression
<A extends Number & Comparable<? super A>>
NumberExpression<A>
castToNum(Class<A> type)
          Create a cast expression to the given numeric type
 NumberExpression<T> ceil()
          Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer
<N extends Number & Comparable<?>>
NumberExpression<Double>
divide(Expression<N> right)
          Get the result of the operation this / right
<N extends Number & Comparable<?>>
NumberExpression<Double>
divide(N right)
          Get the result of the operation this / right
 NumberExpression<Double> doubleValue()
          Get the double expression of this numeric expression
 NumberExpression<Float> floatValue()
          Get the float expression of this numeric expression
 NumberExpression<T> floor()
          Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
<A extends Number & Comparable<?>>
BooleanExpression
goe(A right)
          Create a this >= right expression
<A extends Number & Comparable<?>>
BooleanExpression
goe(Expression<A> right)
          Create a this >= right expression
<A extends Number & Comparable<?>>
BooleanExpression
gt(A right)
          Create a this > right expression
<A extends Number & Comparable<?>>
BooleanExpression
gt(Expression<A> right)
          Create a this > right expression
 BooleanExpression in(Number... numbers)
          Get a this in right expression
 NumberExpression<Integer> intValue()
          Get the int expression of this numeric expression
<A extends Number & Comparable<?>>
BooleanExpression
loe(A right)
          Create a this <= right expression
<A extends Number & Comparable<?>>
BooleanExpression
loe(Expression<A> right)
          Create a this <= right expression
 NumberExpression<Long> longValue()
          Get the long expression of this numeric expression
<A extends Number & Comparable<?>>
BooleanExpression
lt(A right)
          Create a this < right expression
<A extends Number & Comparable<?>>
BooleanExpression
lt(Expression<A> right)
          Create a this < right expression
 NumberExpression<T> max()
          Get the maximum value of this expression (aggregation)
static
<A extends Number & Comparable<?>>
NumberExpression<A>
max(Expression<A> left, Expression<A> right)
          Return the greater of the given values
 NumberExpression<T> min()
          Get the minimum value of this expression (aggregation)
static
<A extends Number & Comparable<?>>
NumberExpression<A>
min(Expression<A> left, Expression<A> right)
          Return the smaller of the given values
 NumberExpression<T> mod(NumberExpression<T> num)
           
 NumberExpression<T> mod(T num)
           
<N extends Number & Comparable<?>>
NumberExpression<T>
multiply(Expression<N> right)
          Get the result of the operation this * right
<N extends Number & Comparable<N>>
NumberExpression<T>
multiply(N right)
          Get the result of the operation this * right
 NumberExpression<T> negate()
          Get the negation of this expression
<A extends Number & Comparable<?>>
BooleanExpression
notBetween(A from, A to)
           
<A extends Number & Comparable<?>>
BooleanExpression
notBetween(Expression<A> from, Expression<A> to)
           
 BooleanExpression notIn(Number... numbers)
          Get a this not in right expression
static NumberExpression<Double> random()
          Returns the random expression
 NumberExpression<Integer> round()
          Returns the closest int to the argument.
 NumberExpression<Short> shortValue()
          Get the short expression of this numeric expression
 NumberExpression<Double> sqrt()
          Get the square root of this numeric expressions
<N extends Number & Comparable<?>>
NumberExpression<T>
subtract(Expression<N> right)
          Get the difference of this and right
<N extends Number & Comparable<?>>
NumberExpression<T>
subtract(N right)
          Get the difference of this and right
 NumberExpression<T> sum()
          Get the sum of this expression (aggregation)
 
Methods inherited from class com.mysema.query.types.expr.ComparableExpressionBase
asc, desc, stringValue
 
Methods inherited from class com.mysema.query.types.expr.SimpleExpression
count, countDistinct, eq, eq, equals, hashCode, in, in, isNotNull, isNull, ne, ne, notIn, notIn, when, when
 
Methods inherited from class com.mysema.query.types.ExpressionBase
getType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.mysema.query.types.Expression
accept
 

Constructor Detail

NumberExpression

public NumberExpression(Class<? extends T> type)
Method Detail

max

public static <A extends Number & Comparable<?>> NumberExpression<A> max(Expression<A> left,
                                                                        Expression<A> right)
Return the greater of the given values

Returns:
max(left, right)

min

public static <A extends Number & Comparable<?>> NumberExpression<A> min(Expression<A> left,
                                                                        Expression<A> right)
Return the smaller of the given values

Returns:
min(left, right)

random

public static NumberExpression<Double> random()
Returns the random expression

Returns:
random()

as

public NumberExpression<T> as(Path<T> alias)
Description copied from class: SimpleExpression
Create an alias for the expression

Overrides:
as in class SimpleExpression<T extends Number & Comparable<?>>
Returns:

as

public NumberExpression<T> as(String alias)
Description copied from class: SimpleExpression
Create an alias for the expression

Overrides:
as in class SimpleExpression<T extends Number & Comparable<?>>
Returns:

abs

public NumberExpression<T> abs()
Get the absolute value of this expression

Returns:
abs(this)

add

public <N extends Number & Comparable<?>> NumberExpression<T> add(Expression<N> right)
Get the sum of this and right

Parameters:
right -
Returns:
this + right

add

public <N extends Number & Comparable<N>> NumberExpression<T> add(N right)
Get the sum of this and right

Parameters:
right -
Returns:
this + right

avg

public NumberExpression<Double> avg()
Get the average value of this expression (aggregation)

Returns:
avg(this)

byteValue

public NumberExpression<Byte> byteValue()
Get the byte expression of this numeric expression

Returns:
this.byteValue()
See Also:
Number.byteValue()

castToNum

public <A extends Number & Comparable<? super A>> NumberExpression<A> castToNum(Class<A> type)
Description copied from class: ComparableExpressionBase
Create a cast expression to the given numeric type

Overrides:
castToNum in class ComparableExpressionBase<T extends Number & Comparable<?>>
Returns:

ceil

public NumberExpression<T> ceil()
Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer

Returns:
ceil(this)
See Also:
Math.ceil(double)

divide

public <N extends Number & Comparable<?>> NumberExpression<Double> divide(Expression<N> right)
Get the result of the operation this / right

Parameters:
right -
Returns:
this / right

divide

public <N extends Number & Comparable<?>> NumberExpression<Double> divide(N right)
Get the result of the operation this / right

Parameters:
right -
Returns:
this / right

doubleValue

public NumberExpression<Double> doubleValue()
Get the double expression of this numeric expression

Returns:
this.doubleValue()
See Also:
Number.doubleValue()

floatValue

public NumberExpression<Float> floatValue()
Get the float expression of this numeric expression

Returns:
this.floatValue()
See Also:
Number.floatValue()

floor

public NumberExpression<T> floor()
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.

Returns:
floor(this)
See Also:
Math.floor(double)

goe

public final <A extends Number & Comparable<?>> BooleanExpression goe(A right)
Create a this >= right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this >= right
See Also:
Comparable.compareTo(Object)

goe

public final <A extends Number & Comparable<?>> BooleanExpression goe(Expression<A> right)
Create a this >= right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this >= right
See Also:
Comparable.compareTo(Object)

gt

public final <A extends Number & Comparable<?>> BooleanExpression gt(A right)
Create a this > right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this > right
See Also:
Comparable.compareTo(Object)

between

public final <A extends Number & Comparable<?>> BooleanExpression between(@Nullable
                                                                         A from,
                                                                         @Nullable
                                                                         A to)
Create a from < this < to expression

Type Parameters:
A -
Parameters:
from -
to -
Returns:

between

public final <A extends Number & Comparable<?>> BooleanExpression between(@Nullable
                                                                         Expression<A> from,
                                                                         @Nullable
                                                                         Expression<A> to)
Create a from < this < to expression

Type Parameters:
A -
Parameters:
from -
to -
Returns:

notBetween

public final <A extends Number & Comparable<?>> BooleanExpression notBetween(A from,
                                                                            A to)
Parameters:
from -
to -
Returns:

notBetween

public final <A extends Number & Comparable<?>> BooleanExpression notBetween(Expression<A> from,
                                                                            Expression<A> to)
Parameters:
from -
to -
Returns:

gt

public final <A extends Number & Comparable<?>> BooleanExpression gt(Expression<A> right)
Create a this > right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this > right
See Also:
Comparable.compareTo(Object)

intValue

public NumberExpression<Integer> intValue()
Get the int expression of this numeric expression

Returns:
this.intValue()
See Also:
Number.intValue()

loe

public final <A extends Number & Comparable<?>> BooleanExpression loe(A right)
Create a this <= right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this <= right
See Also:
Comparable.compareTo(Object)

loe

public final <A extends Number & Comparable<?>> BooleanExpression loe(Expression<A> right)
Create a this <= right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this <= right
See Also:
Comparable.compareTo(Object)

longValue

public NumberExpression<Long> longValue()
Get the long expression of this numeric expression

Returns:
this.longValue()
See Also:
Number.longValue()

lt

public final <A extends Number & Comparable<?>> BooleanExpression lt(A right)
Create a this < right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this < right
See Also:
Comparable.compareTo(Object)

lt

public final <A extends Number & Comparable<?>> BooleanExpression lt(Expression<A> right)
Create a this < right expression

Type Parameters:
A -
Parameters:
right - rhs of the comparison
Returns:
this < right
See Also:
Comparable.compareTo(Object)

max

public NumberExpression<T> max()
Get the maximum value of this expression (aggregation)

Returns:
max(this)

min

public NumberExpression<T> min()
Get the minimum value of this expression (aggregation)

Returns:
min(this)

mod

public NumberExpression<T> mod(NumberExpression<T> num)
Parameters:
num -
Returns:

mod

public NumberExpression<T> mod(T num)
Parameters:
num -
Returns:

multiply

public <N extends Number & Comparable<?>> NumberExpression<T> multiply(Expression<N> right)
Get the result of the operation this * right

Parameters:
right -
Returns:
this * right

multiply

public <N extends Number & Comparable<N>> NumberExpression<T> multiply(N right)
Get the result of the operation this * right

Parameters:
right -
Returns:
this * right

negate

public NumberExpression<T> negate()
Get the negation of this expression

Returns:
this * -1

round

public NumberExpression<Integer> round()
Returns the closest int to the argument.

Returns:
round(this)
See Also:
Math.round(double), Math.round(float)

shortValue

public NumberExpression<Short> shortValue()
Get the short expression of this numeric expression

Returns:
this.shortValue()
See Also:
Number.shortValue()

sqrt

public NumberExpression<Double> sqrt()
Get the square root of this numeric expressions

Returns:
sqrt(this)

subtract

public <N extends Number & Comparable<?>> NumberExpression<T> subtract(Expression<N> right)
Get the difference of this and right

Parameters:
right -
Returns:
this - right

subtract

public <N extends Number & Comparable<?>> NumberExpression<T> subtract(N right)
Get the difference of this and right

Parameters:
right -
Returns:
this - right

sum

public NumberExpression<T> sum()
Get the sum of this expression (aggregation)

Returns:
sum(this)

in

public BooleanExpression in(Number... numbers)
Description copied from class: SimpleExpression
Get a this in right expression

Overrides:
in in class SimpleExpression<T extends Number & Comparable<?>>
Parameters:
numbers - rhs of the comparison
Returns:

notIn

public BooleanExpression notIn(Number... numbers)
Description copied from class: SimpleExpression
Get a this not in right expression

Overrides:
notIn in class SimpleExpression<T extends Number & Comparable<?>>
Parameters:
numbers - rhs of the comparison
Returns:


Copyright © 2007-2011 Mysema Ltd. All Rights Reserved.