Package org.hibernate.dialect.function
Class StandardSQLFunction
- java.lang.Object
-
- org.hibernate.dialect.function.StandardSQLFunction
-
- All Implemented Interfaces:
SQLFunction
- Direct Known Subclasses:
ConditionalParenthesisFunction
,DB2SubstringFunction
,HANASpatialAggregate
,HANASpatialFunction
,StandardAnsiSqlAggregationFunctions.AvgFunction
,StandardAnsiSqlAggregationFunctions.CountFunction
,StandardAnsiSqlAggregationFunctions.MaxFunction
,StandardAnsiSqlAggregationFunctions.MinFunction
,StandardAnsiSqlAggregationFunctions.SumFunction
,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.
-
-
Constructor Summary
Constructors Constructor Description StandardSQLFunction(java.lang.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(java.lang.String name, Type registeredType)
Construct a standard SQL function definition with a static return type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Function name accessorprotected java.lang.String
getRenderedName(java.util.List arguments)
Type
getReturnType(Type firstArgumentType, Mapping mapping)
The return type of the function.Type
getType()
Function static return type accessor.boolean
hasArguments()
Does this function have any arguments?boolean
hasParenthesesIfNoArguments()
If there are no arguments, are parentheses required?java.lang.String
render(Type firstArgumentType, java.util.List arguments, SessionFactoryImplementor sessionFactory)
Render the function call as SQL fragment.java.lang.String
toString()
-
-
-
Constructor Detail
-
StandardSQLFunction
public StandardSQLFunction(java.lang.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(java.lang.String name, Type registeredType)
Construct a standard SQL function definition with a static return type.- Parameters:
name
- The name of the function.registeredType
- The static return type.
-
-
Method Detail
-
getName
public java.lang.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.
-
hasArguments
public boolean hasArguments()
Description copied from interface:SQLFunction
Does this function have any arguments?- Specified by:
hasArguments
in interfaceSQLFunction
- Returns:
- True if the function expects to have parameters; false otherwise.
-
hasParenthesesIfNoArguments
public boolean hasParenthesesIfNoArguments()
Description copied from interface:SQLFunction
If there are no arguments, are parentheses required?- Specified by:
hasParenthesesIfNoArguments
in interfaceSQLFunction
- Returns:
- True if a no-arg call of this function requires parentheses.
-
getReturnType
public Type getReturnType(Type firstArgumentType, Mapping mapping)
Description copied from interface:SQLFunction
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. Note, the 'firstArgumentType' parameter should match the one passed intoSQLFunction.render(org.hibernate.type.Type, java.util.List, org.hibernate.engine.spi.SessionFactoryImplementor)
- Specified by:
getReturnType
in interfaceSQLFunction
- Parameters:
firstArgumentType
- The type of the first argumentmapping
- The mapping source.- Returns:
- The type to be expected as a return.
-
render
public java.lang.String render(Type firstArgumentType, java.util.List arguments, SessionFactoryImplementor sessionFactory)
Description copied from interface:SQLFunction
Render 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)
- Specified by:
render
in interfaceSQLFunction
- Parameters:
firstArgumentType
- The type of the first argumentarguments
- The function argumentssessionFactory
- The SessionFactory- Returns:
- The rendered function call
-
getRenderedName
protected java.lang.String getRenderedName(java.util.List arguments)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-