org.hibernate.dialect.function

Class StandardSQLFunction

Implemented Interfaces:
SQLFunction
Known Direct Subclasses:
ClassicAvgFunction, ClassicCountFunction, ClassicSumFunction, ConditionalParenthesisFunction, StandardJDBCEscapeFunction

public class StandardSQLFunction
extends java.lang.Object
implements SQLFunction

Provides a standard implementation that supports the majority of the HQL functions that are translated to SQL. The Dialect and its sub-classes use this class to provide details required for processing of the associated function.
Author:
David Channon

Constructor Summary

StandardSQLFunction(String name)
Construct a standard SQL function definition with a variable return type; the actual return type will depend on the types to which the function is applied.
StandardSQLFunction(String name, Type type)
Construct a standard SQL function definition with a static return type.

Method Summary

String
getName()
Function name accessor
Type
getReturnType(Type columnType, Mapping mapping)
Type
getType()
Function static return type accessor.
boolean
hasArguments()
boolean
hasParenthesesIfNoArguments()
String
render(List args, SessionFactoryImplementor factory)
String
toString()

Constructor Details

StandardSQLFunction

public StandardSQLFunction(String name)
Construct a standard SQL function definition with a variable return type; the actual return type will depend on the types to which the function is applied.

Using this form, the return type is considered non-static and assumed to be the type of the first argument.

Parameters:
name - The name of the function.

StandardSQLFunction

public StandardSQLFunction(String name,
                           Type type)
Construct a standard SQL function definition with a static return type.
Parameters:
name - The name of the function.
type - The static return type.

Method Details

getName

public String getName()
Function name accessor
Returns:
The function name.

getReturnType

public Type getReturnType(Type columnType,
                          Mapping mapping)
Specified by:
getReturnType in interface SQLFunction

getType

public Type getType()
Function static return type accessor.
Returns:
The static function return type; or null if return type is not static.

hasArguments

public boolean hasArguments()
Specified by:
hasArguments in interface SQLFunction

hasParenthesesIfNoArguments

public boolean hasParenthesesIfNoArguments()
Specified by:
hasParenthesesIfNoArguments in interface SQLFunction

render

public String render(List args,
                     SessionFactoryImplementor factory)
Specified by:
render in interface SQLFunction

toString

public String toString()