Class FunctionDef

java.lang.Object
com.mckoi.database.FunctionDef
All Implemented Interfaces:
Serializable, Cloneable

public final class FunctionDef extends Object implements Serializable, 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.

Author:
Tobias Downer
See Also:
  • Constructor Details

    • FunctionDef

      public FunctionDef(String name, Expression[] params)
      Constructs the FunctionDef.
  • Method Details

    • getName

      public 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 Object clone() throws CloneNotSupportedException
      Performs a deep clone of this object.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      Human understandable string, used for the column title.
      Overrides:
      toString in class Object