Klasse AbstractFunction

java.lang.Object
org.apache.torque.util.functions.AbstractFunction
Alle implementierten Schnittstellen:
Column, SQLFunction

public abstract class AbstractFunction extends Object implements SQLFunction
A default framework that implements the core SQLFunction interface requirements that can be used to build specific functions on.
Version:
$Id: AbstractFunction.java 1879896 2020-07-15 15:03:46Z gk $
Autor:
Greg Monroe
  • Konstruktordetails

    • AbstractFunction

      protected AbstractFunction()
      Functions should only be created via the FunctionFactory class.
  • Methodendetails

    • getSqlExpression

      public abstract String getSqlExpression()
      This should return the SQL string that can be used when constructing the query. E.g. "AVG( table.column )" or CONCAT(table.column, " foobar");
      Angegeben von:
      getSqlExpression in Schnittstelle Column
      Gibt zurück:
      The SQL String.
    • getArguments

      public Object[] getArguments()
      Return all the parameters as an object array. This allow for processing of the parameters in their original format rather than just in String format. E.g. a parameter might be specified as a Date object, or a Column object.
      Angegeben von:
      getArguments in Schnittstelle SQLFunction
      Gibt zurück:
      Should return a valid Object array and not null. E.g. implementors should return new Object[0] if there are no parameters.
    • setArguments

      public void setArguments(Object... args)
      Sets the function arguments.
      Angegeben von:
      setArguments in Schnittstelle SQLFunction
      Parameter:
      args - the function arguments, not null.
    • getColumn

      public Column getColumn()
      Returns the column to which this function is applied.
      Angegeben von:
      getColumn in Schnittstelle SQLFunction
      Gibt zurück:
      the column, not null.
      Löst aus:
      IllegalStateException - if the column cannot be determined.
    • getArgument

      public Object getArgument(int index)
      Return the object representation of the function parameter at the specified index. Will be null if parameter does not exist.
      Angegeben von:
      getArgument in Schnittstelle SQLFunction
      Parameter:
      index - The 0 based index of the parameter to get.
      Gibt zurück:
      The parameter object. Null if one does not exist.
    • addArgument

      protected void addArgument(Object arg)
      Add an argument to the function argument list
      Parameter:
      arg - The argument object.
    • setArgumentList

      protected void setArgumentList(List<Object> args)
      Set the full function argument list.
      Parameter:
      args - The new argument list
    • getArgumentList

      protected List<Object> getArgumentList()
      Get the full list of function arguments
      Gibt zurück:
      The argument list
    • getColumnName

      public String getColumnName()
      Returns the column name. This implementation always return null because we do not reference a real column.
      Angegeben von:
      getColumnName in Schnittstelle Column
      Gibt zurück:
      the column name, always null.
    • getTableName

      public String getTableName()
      Returns the name of the associated table (not prefixed by the schema name) from the function argument(s). In case that no unique table name can be determined, null is returned.
      Angegeben von:
      getTableName in Schnittstelle Column
      Gibt zurück:
      the name of the table, may be null but not blank.
    • getSchemaName

      public String getSchemaName()
      Returns the name of any fixed schema prefix for the column's table (if any) from the function argument(s). In case that no unique schema can be determined, null is returned.
      Angegeben von:
      getSchemaName in Schnittstelle Column
      Gibt zurück:
      the schema name, or null if the schema is not known.
    • getFullTableName

      public String getFullTableName()
      Returns the table name prefixed with the schema name if it exists from the function argument(s). I.e. if a schema name exists, the result will be schemaName.tableName, and otherwise it will just be tableName. In case that no unique full table can be determined, null is returned.
      Angegeben von:
      getFullTableName in Schnittstelle Column
      Gibt zurück:
      the fully qualified table name may be null but not blank.