站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 3.2.3 正式版 API 英文文档

StandardSQLFunction (Hibernate API Documentation) - Hibernate 3.2.3 正式版 API 英文文档


org.hibernate.dialect.function
Class StandardSQLFunction

java.lang.Object
  extended byorg.hibernate.dialect.function.StandardSQLFunction
All Implemented Interfaces:
SQLFunction
Direct Known Subclasses:
ClassicAvgFunction, ClassicCountFunction, ClassicSumFunction, ConditionalParenthesisFunction, StandardJDBCEscapeFunction

public class StandardSQLFunction
extends 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)
          The return type of the function. May be either a concrete type which is preset, or variable depending upon the type of the first function argument.
 Type getType()
          Function static return type accessor.
 boolean hasArguments()
          Does this function have any arguments?
 boolean hasParenthesesIfNoArguments()
          If there are no arguments, are parens required?
 String render(List args, SessionFactoryImplementor factory)
          Render the function call as SQL fragment.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

getName

public String getName()
Function name accessor

Returns:
The function name.

getType

public Type getType()
Function static return type accessor.

Returns:
The static function return type; or null if return type is not static.

getReturnType

public Type getReturnType(Type columnType,
                          Mapping mapping)
The return type of the function. May be either a concrete type which is preset, or variable depending upon the type of the first function argument.

Specified by:
getReturnType in interface SQLFunction
Parameters:
columnType - the type of the first argument
mapping - The mapping source.
Returns:
The type to be expected as a return.

hasArguments

public boolean hasArguments()
Does this function have any arguments?

Specified by:
hasArguments in interface SQLFunction
Returns:
True if the function expects to have parameters; false otherwise.

hasParenthesesIfNoArguments

public boolean hasParenthesesIfNoArguments()
If there are no arguments, are parens required?

Specified by:
hasParenthesesIfNoArguments in interface SQLFunction
Returns:
True if a no-arg call of this function requires parentheses.

render

public String render(List args,
                     SessionFactoryImplementor factory)
Render the function call as SQL fragment.

Specified by:
render in interface SQLFunction
Parameters:
args - The function arguments
factory - The SessionFactory
Returns:
The rendered function call

toString

public String toString()