# 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 types

Numeric type is an any type inherited from `Number`.

Provides basic math functions like `mod(Number)`, `abs()` and `sqrt()`. It is also implements `ComparableProperty` interface.

Since:
  4.2
See Also:
  - `org.apache.cayenne.exp.property`

- ## Field Summary

  ### Fields inherited from class BaseProperty

  `expressionSupplier, path, type`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `NumericProperty(CayennePath path, Expression expression, Class<E> type)`
  Constructs a new property with the given name and expression

- ## Method Summary

  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 property
  `NumericProperty<E>`
  `avg()`
  `NumericProperty<E>`
  `div(E value)`
  `NumericProperty<E>`
  `div(NumericProperty<?> value)`
  `NumericProperty<E>`
  `enclosing()`
  This operator allows to access properties of the enclosing query from the subquery.
  `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 BaseProperty

  `aggregate, asc, ascInsensitive, ascInsensitives, ascs, count, countDistinct, desc, descInsensitive, descInsensitives, descs, eq, eq, equals, function, function, getAlias, getExpression, getFrom, getFromAll, getName, getPath, getType, hashCode, in, in, in, isFalse, isNotNull, isNull, isTrue, ne, ne, nin, nin, nin, operator, operator, setIn, setInAll`

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ComparableProperty

  `between, between, gt, gt, gtAll, gtAny, gte, gte, gteAll, gteAny, lt, lt, ltAll, ltAny, lte, lte, lteAll, lteAny`

  ### Methods inherited from interface Property

  `getAlias, getExpression, getName, getPath, getType`

- ## Constructor Details

  - ### NumericProperty

    protected NumericProperty(CayennePath path, Expression expression, Class<E> type)
    Constructs a new property with the given name and expression
    Parameters:
      `path` - of the property (will be used as alias for the expression)
      `expression` - expression for property
      `type` - of the property
    See Also:
      - `PropertyFactory.createNumeric(String, Expression, Class)`

- ## Method Details

  - ### avg

    public NumericProperty<E> avg()
    See Also:
      - `FunctionExpressionFactory.avgExp(Expression)`

  - ### sum

    public NumericProperty<E> sum()
    See Also:
      - `FunctionExpressionFactory.sumExp(Expression)`

  - ### max

    public NumericProperty<E> max()
    Specified by:
      `max` in interface `ComparableProperty<E extends Number>`
    See Also:
      - `FunctionExpressionFactory.maxExp(Expression)`

  - ### min

    public NumericProperty<E> min()
    Specified by:
      `min` in interface `ComparableProperty<E extends Number>`
    See Also:
      - `FunctionExpressionFactory.minExp(Expression)`

  - ### mod

    public NumericProperty<E> mod(Number number)
    See Also:
      - `FunctionExpressionFactory.modExp(Expression, Number)`

  - ### mod

    public NumericProperty<E> mod(NumericProperty<?> number)
    See Also:
      - `FunctionExpressionFactory.modExp(Expression, 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 class `BaseProperty<E extends Number>`

  - ### enclosing

    public NumericProperty<E> enclosing()
    Description copied from class: `BaseProperty`
    This operator allows to access properties of the enclosing query from the subquery. It allows multiple nesting levels to access a corresponding query in case of multiple levels of subqueries. Example:

        ObjectSelect.query(Artist.class)
                        .where(ExpressionFactory.notExists(ObjectSelect.query(Painting.class)
                                .where(Painting.TO_ARTIST.eq(Artist.ARTIST_ID_PK_PROPERTY.enclosing()))))

    Overrides:
      `enclosing` in class `BaseProperty<E extends Number>`
    Returns:
      property that will be translated relative to parent query