org.eobjects.metamodel.query
Enum FunctionType

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

public enum FunctionType
extends Enum<FunctionType>

Represents an aggregate function to use in a SelectItem.

See Also:
SelectItem

Enum Constant Summary
AVG
           
COUNT
           
MAX
           
MIN
           
SUM
           
 
Method Summary
abstract  AggregateBuilder<?> build()
           
 SelectItem createSelectItem(Column column)
           
 SelectItem createSelectItem(String expression, String alias)
           
 Object evaluate(Iterable<?> values)
           
 Object evaluate(Object... values)
          Executes the function
static FunctionType get(String functionName)
           
 ColumnType getExpectedColumnType(ColumnType type)
           
static FunctionType valueOf(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(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getExpectedColumnType

public ColumnType getExpectedColumnType(ColumnType type)

createSelectItem

public SelectItem createSelectItem(Column column)

createSelectItem

public SelectItem createSelectItem(String expression,
                                   String alias)

evaluate

public Object evaluate(Iterable<?> values)

evaluate

public Object evaluate(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.

build

public abstract AggregateBuilder<?> build()

get

public static FunctionType get(String functionName)


Copyright © 2007-2013. All Rights Reserved.