dk.eobjects.metamodel.query
Enum FunctionType

java.lang.Object
  extended by java.lang.Enum<FunctionType>
      extended by dk.eobjects.metamodel.query.FunctionType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FunctionType>

public enum FunctionType
extends java.lang.Enum<FunctionType>

Represents an aggregate function to use in a SelectItem.

See Also:
SelectItem

Enum Constant Summary
AVG
           
COUNT
           
MAX
           
MIN
           
SUM
           
 
Method Summary
 SelectItem createSelectItem(Column column)
           
 SelectItem createSelectItem(java.lang.String expression, java.lang.String alias)
           
 java.lang.Object evaluate(java.lang.Object... values)
          Executes the function
static FunctionType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static FunctionType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

COUNT

public static final FunctionType COUNT

AVG

public static final FunctionType AVG

SUM

public static final FunctionType SUM

MAX

public static final FunctionType MAX

MIN

public static final FunctionType MIN
Method Detail

values

public static FunctionType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (FunctionType c : FunctionType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static FunctionType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

createSelectItem

public SelectItem createSelectItem(Column column)

createSelectItem

public SelectItem createSelectItem(java.lang.String expression,
                                   java.lang.String alias)

evaluate

public java.lang.Object evaluate(java.lang.Object... values)
Executes the function

Parameters:
values - the values to be evaluated. If a value is null it won't be evaluated
Returns:
the result of the function execution. The return type class is dependent on the FunctionType and the values provided. COUNT yields a Long, AVG and SUM yields Double values and MAX and MIN yields the type of the provided values.


Copyright © 2007-2008. All Rights Reserved.