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.Cloneable
A 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.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Function
cached_function
A cached Function object that was generated when this FunctionDef was looked up.private java.lang.String
name
The name of the function.private Expression[]
params
The list of parameters for the function.(package private) static long
serialVersionUID
-
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.Object
clone()
Performs a deep clone of this object.Function
getFunction(QueryContext context)
Returns a Function object from this FunctionDef.java.lang.String
getName()
The name of the function.Expression[]
getParameters()
The list of parameters that are passed to the function.boolean
isAggregate(QueryContext context)
Returns true if this function is an aggregate, or the parameters are aggregates.java.lang.String
toString()
Human understandable string, used for the column title.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
name
private java.lang.String name
The name of the function.
-
params
private Expression[] params
The list of parameters for the function.
-
cached_function
private transient Function cached_function
A cached Function object that was generated when this FunctionDef was looked up. Note that the Function object is transient.
-
-
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.CloneNotSupportedException
Performs a deep clone of this object.- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
toString
public java.lang.String toString()
Human understandable string, used for the column title.- Overrides:
toString
in classjava.lang.Object
-
-