Class 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.

    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.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.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • toString

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