com.google.visualization.datasource.query.scalarfunction
Class CurrentDateTime

java.lang.Object
  extended by com.google.visualization.datasource.query.scalarfunction.CurrentDateTime
All Implemented Interfaces:
ScalarFunction

public class CurrentDateTime
extends java.lang.Object
implements ScalarFunction

A 0-ary function that returns the current datetime. The return type is always DateTime.

Author:
Liron L.

Method Summary
 Value evaluate(java.util.List<Value> values)
          Evaluates this scalar function.
 java.lang.String getFunctionName()
          Returns the function's name.
static CurrentDateTime getInstance()
          Returns the singleton instance of this class.
 ValueType getReturnType(java.util.List<ValueType> types)
          Returns the return type of the function.
 java.lang.String toQueryString(java.util.List<java.lang.String> argumentsQueryStrings)
          Returns a string that when given to the query parser will yield a similar scalar function.
 void validateParameters(java.util.List<ValueType> types)
          Validates that there are no parameters given for the function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CurrentDateTime getInstance()
Returns the singleton instance of this class.

Returns:
The singleton instance of this class.

getFunctionName

public java.lang.String getFunctionName()
Returns the function's name.

Specified by:
getFunctionName in interface ScalarFunction
Returns:
The function's name.

evaluate

public Value evaluate(java.util.List<Value> values)
Evaluates this scalar function. Returns a DateTime with the current time.

Specified by:
evaluate in interface ScalarFunction
Parameters:
values - Ignored.
Returns:
A DateTime value with the current time.

getReturnType

public ValueType getReturnType(java.util.List<ValueType> types)
Returns the return type of the function. In this case, DATETIME.

Specified by:
getReturnType in interface ScalarFunction
Parameters:
types - Ignored.
Returns:
The type of the returned value: DATETIME.

validateParameters

public void validateParameters(java.util.List<ValueType> types)
                        throws InvalidQueryException
Validates that there are no parameters given for the function. Throws a ScalarFunctionException otherwise.

Specified by:
validateParameters in interface ScalarFunction
Parameters:
types - A list with parameters types. Should be empty for this type of function.
Throws:
InvalidQueryException - Thrown if the parameters are invalid.

toQueryString

public java.lang.String toQueryString(java.util.List<java.lang.String> argumentsQueryStrings)
Returns a string that when given to the query parser will yield a similar scalar function. Takes as arguments the query strings of the arguments.

Specified by:
toQueryString in interface ScalarFunction
Parameters:
argumentsQueryStrings - The query strings of the actual arguments.
Returns:
The query string.


Copyright © 2009 Google. All Rights Reserved.