com.holonplatform.core.query

## Interface QueryFunction<T,A>

- Type Parameters:
    `T` - Function result type
    `A` - Function arguments type
  All Superinterfaces:
    Expression, QueryExpression<T>, QueryProjection<T>, TypedExpression<T>
  All Known Subinterfaces:
    QueryFunction.Avg, QueryFunction.Count, QueryFunction.Max<T>, QueryFunction.Min<T>, QueryFunction.NoArgQueryFunction<T>, QueryFunction.PropertyQueryFunction<T,A>, QueryFunction.Sum<T>, StringFunction, StringFunction.Lower, StringFunction.Upper, TemporalFunction<T>, TemporalFunction.CurrentDate, TemporalFunction.CurrentLocalDate, TemporalFunction.CurrentLocalDateTime, TemporalFunction.CurrentTimestamp, TemporalFunction.Day, TemporalFunction.Hour, TemporalFunction.Month, TemporalFunction.Year

      public interface QueryFunction<T,A>
      extends QueryExpression<T>, QueryProjection<T>

  Represents a function expression. A function can be used as `QueryProjection` too.
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `QueryFunction.Avg` A function which represents the average value of a query result.
    `static interface` | `QueryFunction.Count` A function which represents the count of a query result values.
    `static interface` | `QueryFunction.Max<T>` A function which represents the largest value of a query result.
    `static interface` | `QueryFunction.Min<T>` A function which represents the smallest value of a query result.
    `static interface` | `QueryFunction.NoArgQueryFunction<T>` A `QueryFunction` which do not support any argument.
    `static interface` | `QueryFunction.PropertyQueryFunction<T,A>` A `QueryFunction` which is also a `Property`, allowing the function to be used within a property set query projection and the function value to be collected in a `PropertyBox`.
    `static interface` | `QueryFunction.Sum<T extends Number>` A function which represents the sum of a numeric query result values.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.Expression

      `Expression.ExpressionResolverFunction<E extends Expression,R extends Expression>, Expression.InvalidExpressionException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static QueryFunction.Avg` | `avg(TypedExpression<? extends Number> argument)` Creates an aggregate function to calculate the average value of a numeric query result.
    `static QueryFunction.Count` | `count(TypedExpression<?> argument)` Creates an aggregate function to count query results.
    `static TemporalFunction.CurrentDate` | `currentDate()` Create a `TemporalFunction.CurrentDate` function to obtain the current date as a `Date`.
    `static TemporalFunction.CurrentLocalDate` | `currentLocalDate()` Create a `TemporalFunction.CurrentLocalDate` function to obtain the current date as a `LocalDate`.
    `static TemporalFunction.CurrentLocalDateTime` | `currentLocalDateTime()` Create a `TemporalFunction.CurrentLocalDateTime` function to obtain the current date and time as a `LocalDateTime`.
    `static TemporalFunction.CurrentTimestamp` | `currentTimestamp()` Create a `TemporalFunction.CurrentTimestamp` function to obtain the current timestamp as a `Date`.
    `static TemporalFunction.Day` | `day(TypedExpression<?> argument)` Create a function to extract the day part of a temporal data type.
    `List<TypedExpression<? extends A>>` | `getExpressionArguments()` If the function supports expression arguments, returns the arguments list.
    `static TemporalFunction.Hour` | `hour(TypedExpression<?> argument)` Create a function to extract the hour part of a temporal data type.
    `static StringFunction.Lower` | `lower(TypedExpression<String> argument)` Creates a function to convert a String data type into lowercase.
    `static <T> QueryFunction.Max<T>` | `max(TypedExpression<T> argument)` Creates an aggregate function to get the largest value of a query result.
    `static <T> QueryFunction.Min<T>` | `min(TypedExpression<T> argument)` Creates an aggregate function to get the smallest value of a query result.
    `static TemporalFunction.Month` | `month(TypedExpression<?> argument)` Create a function to extract the month part of a temporal data type.
    `static <T extends Number> QueryFunction.Sum<T>` | `sum(TypedExpression<T> argument)` Creates an aggregate function to sum numeric query results.
    `static StringFunction.Upper` | `upper(TypedExpression<String> argument)` Creates a function to convert a String data type into uppercase.
    `static TemporalFunction.Year` | `year(TypedExpression<?> argument)` Create a function to extract the year part of a temporal data type.

    - ### Methods inherited from interface com.holonplatform.core.query.QueryExpression

      `between, count, eq, eq, goe, goe, gt, gt, in, in, in, isNotNull, isNull, loe, loe, lt, lt, max, min, neq, neq, nin, nin, nin`

    - ### Methods inherited from interface com.holonplatform.core.query.QueryProjection

      `bean, constant, countAll, path, propertySet, propertySet`

    - ### Methods inherited from interface com.holonplatform.core.TypedExpression

      `getTemporalType, getType, isCollectionExpression, isConverterExpression`

    - ### Methods inherited from interface com.holonplatform.core.Expression

      `validate`

- - ### Method Detail

    - #### getExpressionArguments

          List<TypedExpression<? extends A>> getExpressionArguments()

      If the function supports expression arguments, returns the arguments list.
      Returns:
        Function arguments, an empty list if none

    - #### count

          static QueryFunction.Count count(TypedExpression<?> argument)

      Creates an aggregate function to count query results.
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `QueryFunction.Count` function

    - #### avg

          static QueryFunction.Avg avg(TypedExpression<? extends Number> argument)

      Creates an aggregate function to calculate the average value of a numeric query result.
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `QueryFunction.Avg` function

    - #### min

          static <T> QueryFunction.Min<T> min(TypedExpression<T> argument)

      Creates an aggregate function to get the smallest value of a query result.
      Type Parameters:
        `T` - Result type
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `QueryFunction.Min` function

    - #### max

          static <T> QueryFunction.Max<T> max(TypedExpression<T> argument)

      Creates an aggregate function to get the largest value of a query result.
      Type Parameters:
        `T` - Result type
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `QueryFunction.Max` function

    - #### sum

          static <T extends Number> QueryFunction.Sum<T> sum(TypedExpression<T> argument)

      Creates an aggregate function to sum numeric query results.
      Type Parameters:
        `T` - Result type
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `QueryFunction.Sum` function

    - #### lower

          static StringFunction.Lower lower(TypedExpression<String> argument)

      Creates a function to convert a String data type into lowercase.
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `StringFunction.Lower` function

    - #### upper

          static StringFunction.Upper upper(TypedExpression<String> argument)

      Creates a function to convert a String data type into uppercase.
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A new `StringFunction.Lower` function

    - #### currentDate

          static TemporalFunction.CurrentDate currentDate()

      Create a `TemporalFunction.CurrentDate` function to obtain the current date as a `Date`.
      Returns:
        A function expression to obtain the current date as a `Date`.

    - #### currentLocalDate

          static TemporalFunction.CurrentLocalDate currentLocalDate()

      Create a `TemporalFunction.CurrentLocalDate` function to obtain the current date as a `LocalDate`.
      Returns:
        A function expression to obtain the current date as a `LocalDate`.

    - #### currentTimestamp

          static TemporalFunction.CurrentTimestamp currentTimestamp()

      Create a `TemporalFunction.CurrentTimestamp` function to obtain the current timestamp as a `Date`.
      Returns:
        A function expression to obtain the current timestamp

    - #### currentLocalDateTime

          static TemporalFunction.CurrentLocalDateTime currentLocalDateTime()

      Create a `TemporalFunction.CurrentLocalDateTime` function to obtain the current date and time as a `LocalDateTime`.
      Returns:
        A function expression to obtain the current date and time as a `LocalDateTime`.

    - #### year

          static TemporalFunction.Year year(TypedExpression<?> argument)

      Create a function to extract the year part of a temporal data type.
      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A function to extract the year part of a temporal data type.

    - #### month

          static TemporalFunction.Month month(TypedExpression<?> argument)

      Create a function to extract the month part of a temporal data type.

      The month range index is between 1 and 12.

      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A function to extract the month part of a temporal data type.

    - #### day

          static TemporalFunction.Day day(TypedExpression<?> argument)

      Create a function to extract the day part of a temporal data type.

      The day is intended as the day of month and the day range index is between 1 and 31.

      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A function to extract the day part of a temporal data type.

    - #### hour

          static TemporalFunction.Hour hour(TypedExpression<?> argument)

      Create a function to extract the hour part of a temporal data type.

      The 24-hour clock is used and the hour range index is between 0 and 23.

      Parameters:
        `argument` - Function argument (not null)
      Returns:
        A function to extract the hour part of a temporal data type.

Copyright © 2019 The Holon Platform. All rights reserved.