Package org.hibernate.dialect.function
Class DynamicDispatchFunction
- java.lang.Object
-
- org.hibernate.dialect.function.DynamicDispatchFunction
-
- All Implemented Interfaces:
SqmFunctionDescriptor
,ArgumentsValidator
public class DynamicDispatchFunction extends Object implements SqmFunctionDescriptor, ArgumentsValidator
A function that dynamically dispatches to other functions, depending on which function validates successfully first. This can be used for overload implementations.- Since:
- 6.6
-
-
Constructor Summary
Constructors Constructor Description DynamicDispatchFunction(SqmFunctionRegistry functionRegistry, String... functionNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> SelfRenderingSqmFunction<T>
generateAggregateSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
LikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)
, but also accepts afilter
predicate.<T> SelfRenderingSqmFunction<T>
generateOrderedSetAggregateSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, SqmOrderByClause withinGroupClause, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
LikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)
, but also accepts afilter
predicate and anorder by
clause.<T> SelfRenderingSqmFunction<T>
generateSqmExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Instantiate this template with the given arguments and expected return type.<T> SelfRenderingSqmFunction<T>
generateWindowSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, Boolean respectNulls, Boolean fromFirst, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
LikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)
but also accepts afilter
predicate.ArgumentsValidator
getArgumentsValidator()
The object responsible for validating arguments of the function.FunctionKind
getFunctionKind()
What sort of function is this?void
validate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration)
Perform validation that may be done using theSqmTypedNode
tree and assigned Java types.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.query.sqm.produce.function.ArgumentsValidator
getSignature, validate, validateSqlTypes
-
Methods inherited from interface org.hibernate.query.sqm.function.SqmFunctionDescriptor
alwaysIncludesParentheses, generateSqmExpression, generateSqmExpression, getSignature
-
-
-
-
Constructor Detail
-
DynamicDispatchFunction
public DynamicDispatchFunction(SqmFunctionRegistry functionRegistry, String... functionNames)
-
-
Method Detail
-
getFunctionKind
public FunctionKind getFunctionKind()
Description copied from interface:SqmFunctionDescriptor
What sort of function is this?- Specified by:
getFunctionKind
in interfaceSqmFunctionDescriptor
- Returns:
FunctionKind.NORMAL
by default
-
generateSqmExpression
public <T> SelfRenderingSqmFunction<T> generateSqmExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptor
Instantiate this template with the given arguments and expected return type. This produces a tree of SQM nodes representing a tree of function invocations. This allows a single HQL function to be defined in terms of other predefined (database independent) HQL functions, simplifying the task of writing HQL functions which are portable between databases.- Specified by:
generateSqmExpression
in interfaceSqmFunctionDescriptor
-
generateAggregateSqmExpression
public <T> SelfRenderingSqmFunction<T> generateAggregateSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptor
LikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)
, but also accepts afilter
predicate.This method is intended for aggregate functions.
- Specified by:
generateAggregateSqmExpression
in interfaceSqmFunctionDescriptor
-
generateOrderedSetAggregateSqmExpression
public <T> SelfRenderingSqmFunction<T> generateOrderedSetAggregateSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, SqmOrderByClause withinGroupClause, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptor
LikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)
, but also accepts afilter
predicate and anorder by
clause.This method is intended for ordered set aggregate functions.
- Specified by:
generateOrderedSetAggregateSqmExpression
in interfaceSqmFunctionDescriptor
-
generateWindowSqmExpression
public <T> SelfRenderingSqmFunction<T> generateWindowSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, Boolean respectNulls, Boolean fromFirst, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptor
LikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)
but also accepts afilter
predicate.This method is intended for window functions.
- Specified by:
generateWindowSqmExpression
in interfaceSqmFunctionDescriptor
-
getArgumentsValidator
public ArgumentsValidator getArgumentsValidator()
Description copied from interface:SqmFunctionDescriptor
The object responsible for validating arguments of the function.- Specified by:
getArgumentsValidator
in interfaceSqmFunctionDescriptor
- Returns:
- an instance of
ArgumentsValidator
-
validate
public void validate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration)
Description copied from interface:ArgumentsValidator
Perform validation that may be done using theSqmTypedNode
tree and assigned Java types.- Specified by:
validate
in interfaceArgumentsValidator
-
-