Package org.apache.cayenne.exp.property
Class NumericProperty<E extends Number>
- java.lang.Object
-
- org.apache.cayenne.exp.property.BaseProperty<E>
-
- org.apache.cayenne.exp.property.NumericProperty<E>
-
- All Implemented Interfaces:
ComparableProperty<E>
,Property<E>
- Direct Known Subclasses:
NumericIdProperty
public class NumericProperty<E extends Number> extends BaseProperty<E> implements ComparableProperty<E>
Property that represents attributes mapped on numeric typesNumeric type is an any type inherited from
Number
.Provides basic math functions like
mod(Number)
,abs()
andsqrt()
. It is also implementsComparableProperty
interface.- Since:
- 4.2
- See Also:
org.apache.cayenne.exp.property
-
-
Field Summary
-
Fields inherited from class org.apache.cayenne.exp.property.BaseProperty
expressionSupplier, name, type
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NumericProperty(String name, Expression expression, Class<E> type)
Constructs a new property with the given name and expression
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NumericProperty<E>
abs()
NumericProperty<E>
add(E value)
NumericProperty<E>
add(NumericProperty<?> value)
NumericProperty<E>
alias(String alias)
Creates alias with different name for this propertyNumericProperty<E>
avg()
NumericProperty<E>
div(E value)
NumericProperty<E>
div(NumericProperty<?> value)
NumericProperty<E>
enclosing()
NumericProperty<E>
max()
NumericProperty<E>
min()
NumericProperty<E>
mod(Number number)
NumericProperty<E>
mod(NumericProperty<?> number)
NumericProperty<E>
mul(E value)
NumericProperty<E>
mul(NumericProperty<?> value)
NumericProperty<E>
neg()
NumericProperty<E>
sqrt()
NumericProperty<E>
sub(E value)
NumericProperty<E>
sub(NumericProperty<?> value)
NumericProperty<E>
sum()
-
Methods inherited from class org.apache.cayenne.exp.property.BaseProperty
asc, ascInsensitive, ascInsensitives, ascs, count, countDistinct, desc, descInsensitive, descInsensitives, descs, eq, eq, equals, function, function, getAlias, getExpression, getFrom, getFromAll, getName, getType, hashCode, in, in, in, isFalse, isNotNull, isNull, isTrue, ne, ne, nin, nin, nin, operator, operator, path, setIn, setInAll
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cayenne.exp.property.ComparableProperty
between, between, gt, gt, gte, gte, lt, lt, lte, lte
-
Methods inherited from interface org.apache.cayenne.exp.property.Property
getAlias, getExpression, getName, getType
-
-
-
-
Constructor Detail
-
NumericProperty
protected NumericProperty(String name, Expression expression, Class<E> type)
Constructs a new property with the given name and expression- Parameters:
name
- of the property (will be used as alias for the expression)expression
- expression for propertytype
- of the property- See Also:
PropertyFactory.createNumeric(String, Expression, Class)
-
-
Method Detail
-
avg
public NumericProperty<E> avg()
-
sum
public NumericProperty<E> sum()
-
max
public NumericProperty<E> max()
- Specified by:
max
in interfaceComparableProperty<E extends Number>
- See Also:
FunctionExpressionFactory.maxExp(Expression)
-
min
public NumericProperty<E> min()
- Specified by:
min
in interfaceComparableProperty<E extends Number>
- See Also:
FunctionExpressionFactory.minExp(Expression)
-
mod
public NumericProperty<E> mod(Number number)
-
mod
public NumericProperty<E> mod(NumericProperty<?> number)
-
abs
public NumericProperty<E> abs()
- Returns:
- new property that represents abs() function call with current property as argument
- See Also:
FunctionExpressionFactory.absExp(Expression)
-
sqrt
public NumericProperty<E> sqrt()
- Returns:
- new property that represents sqrt() function call with current property as argument
- See Also:
FunctionExpressionFactory.sqrtExp(Expression)
-
add
public NumericProperty<E> add(E value)
- Returns:
- new property that represents '+' operator with current property as argument
-
add
public NumericProperty<E> add(NumericProperty<?> value)
- Returns:
- new property that represents '+' operator with current property as argument
-
sub
public NumericProperty<E> sub(E value)
- Returns:
- new property that represents '-' operator with current property as argument
-
sub
public NumericProperty<E> sub(NumericProperty<?> value)
- Returns:
- new property that represents '-' operator with current property as argument
-
div
public NumericProperty<E> div(E value)
- Returns:
- new property that represents '/' operator with current property as argument
-
div
public NumericProperty<E> div(NumericProperty<?> value)
- Returns:
- new property that represents '/' operator with current property as argument
-
mul
public NumericProperty<E> mul(E value)
- Returns:
- new property that represents '*' operator with current property as argument
-
mul
public NumericProperty<E> mul(NumericProperty<?> value)
- Returns:
- new property that represents '*' operator with current property as argument
-
neg
public NumericProperty<E> neg()
- Returns:
- new property that represents negative value of current property
-
alias
public NumericProperty<E> alias(String alias)
Creates alias with different name for this property- Overrides:
alias
in classBaseProperty<E extends Number>
-
enclosing
public NumericProperty<E> enclosing()
- Overrides:
enclosing
in classBaseProperty<E extends Number>
- Returns:
- property that will be translated relative to parent query
-
-