Package com.mckoi.database
Class FunctionDef
- java.lang.Object
-
- com.mckoi.database.FunctionDef
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public final class FunctionDef extends java.lang.Object implements java.io.Serializable, java.lang.CloneableA definition of a function including its name and parameters. A FunctionDef can easily be transformed into a Function object via a set of FunctionFactory instances.NOTE: This object is NOT immutable or thread-safe. A FunctionDef should not be shared among different threads.
- Author:
- Tobias Downer
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FunctionDef(java.lang.String name, Expression[] params)Constructs the FunctionDef.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Performs a deep clone of this object.FunctiongetFunction(QueryContext context)Returns a Function object from this FunctionDef.java.lang.StringgetName()The name of the function.Expression[]getParameters()The list of parameters that are passed to the function.booleanisAggregate(QueryContext context)Returns true if this function is an aggregate, or the parameters are aggregates.java.lang.StringtoString()Human understandable string, used for the column title.
-
-
-
Constructor Detail
-
FunctionDef
public FunctionDef(java.lang.String name, Expression[] params)Constructs the FunctionDef.
-
-
Method Detail
-
getName
public java.lang.String getName()
The name of the function. For example, 'MIN' or 'CONCAT'.
-
getParameters
public Expression[] getParameters()
The list of parameters that are passed to the function. For example, a concat function may have 7 parameters ('There', ' ', 'are', ' ', 10, ' ', 'bottles.')
-
isAggregate
public boolean isAggregate(QueryContext context)
Returns true if this function is an aggregate, or the parameters are aggregates. It requires a QueryContext object to lookup the function in the function factory database.
-
getFunction
public Function getFunction(QueryContext context)
Returns a Function object from this FunctionDef. Note that two calls to this method will produce the same Function object, however the same Function object will not be produced over multiple instances of FunctionDef even when they represent the same thing.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionPerforms a deep clone of this object.- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
toString
public java.lang.String toString()
Human understandable string, used for the column title.- Overrides:
toStringin classjava.lang.Object
-
-