类 VarArgsSQLFunction
- java.lang.Object
-
- org.hibernate.dialect.function.VarArgsSQLFunction
-
- 所有已实现的接口:
SQLFunction
public class VarArgsSQLFunction extends Object implements SQLFunction
Support for slightly more general templating thanStandardSQLFunction, with an unlimited number of arguments.- 作者:
- Gavin King
-
-
构造器概要
构造器 构造器 说明 VarArgsSQLFunction(String begin, String sep, String end)Constructs a VarArgsSQLFunction instance with a 'dynamic' return type.VarArgsSQLFunction(Type registeredType, String begin, String sep, String end)Constructs a VarArgsSQLFunction instance with a 'static' return type.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 TypegetReturnType(Type firstArgumentType, Mapping mapping)The return type of the function.booleanhasArguments()Does this function have any arguments?booleanhasParenthesesIfNoArguments()If there are no arguments, are parentheses required?Stringrender(Type firstArgumentType, List arguments, SessionFactoryImplementor factory)Render the function call as SQL fragment.protected StringtransformArgument(String argument)Called fromrender(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor)to allow applying a change or transformation to each individual argument.
-
-
-
构造器详细资料
-
VarArgsSQLFunction
public VarArgsSQLFunction(Type registeredType, String begin, String sep, String end)
Constructs a VarArgsSQLFunction instance with a 'static' return type. An example of a 'static' return type would be something like an UPPER function which is always returning a SQL VARCHAR and thus a string type.- 参数:
registeredType- The return type.begin- The beginning of the function templating.sep- The separator for each individual function argument.end- The end of the function templating.
-
VarArgsSQLFunction
public VarArgsSQLFunction(String begin, String sep, String end)
Constructs a VarArgsSQLFunction instance with a 'dynamic' return type. For a dynamic return type, the type of the arguments are used to resolve the type. An example of a function with a 'dynamic' return would be MAX or MIN which return a double or an integer etc based on the types of the arguments.- 参数:
begin- The beginning of the function templating.sep- The separator for each individual function argument.end- The end of the function templating.- 另请参阅:
Specifically, the 'firstArgumentType' argument is the 'dynamic' type.
-
-
方法详细资料
-
hasArguments
public boolean hasArguments()
从接口复制的说明:SQLFunctionDoes this function have any arguments?- 指定者:
hasArguments在接口中SQLFunction- 返回:
- True if the function expects to have parameters; false otherwise.
-
hasParenthesesIfNoArguments
public boolean hasParenthesesIfNoArguments()
从接口复制的说明:SQLFunctionIf there are no arguments, are parentheses required?- 指定者:
hasParenthesesIfNoArguments在接口中SQLFunction- 返回:
- True if a no-arg call of this function requires parentheses.
-
getReturnType
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException
从接口复制的说明:SQLFunctionThe 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. Note, the 'firstArgumentType' parameter should match the one passed intoSQLFunction.render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor)- 指定者:
getReturnType在接口中SQLFunction- 参数:
firstArgumentType- The type of the first argumentmapping- The mapping source.- 返回:
- The type to be expected as a return.
- 抛出:
QueryException- Indicates an issue resolving the return type.
-
render
public String render(Type firstArgumentType, List arguments, SessionFactoryImplementor factory)
从接口复制的说明:SQLFunctionRender the function call as SQL fragment. Note, the 'firstArgumentType' parameter should match the one passed intoSQLFunction.getReturnType(org.hibernate.type.Type, org.hibernate.engine.spi.Mapping)- 指定者:
render在接口中SQLFunction- 参数:
firstArgumentType- The type of the first argumentarguments- The function argumentsfactory- The SessionFactory- 返回:
- The rendered function call
-
transformArgument
protected String transformArgument(String argument)
Called fromrender(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor)to allow applying a change or transformation to each individual argument.- 参数:
argument- The argument being processed.- 返回:
- The transformed argument; may be the same, though should never be null.
-
-