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 afilterpredicate.<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 afilterpredicate and anorder byclause.<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 afilterpredicate.ArgumentsValidatorgetArgumentsValidator()The object responsible for validating arguments of the function.FunctionKindgetFunctionKind()What sort of function is this?voidvalidate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration)Perform validation that may be done using theSqmTypedNodetree 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:SqmFunctionDescriptorWhat sort of function is this?- Specified by:
getFunctionKindin interfaceSqmFunctionDescriptor- Returns:
FunctionKind.NORMALby default
-
generateSqmExpression
public <T> SelfRenderingSqmFunction<T> generateSqmExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptorInstantiate 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:
generateSqmExpressionin interfaceSqmFunctionDescriptor
-
generateAggregateSqmExpression
public <T> SelfRenderingSqmFunction<T> generateAggregateSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptorLikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine), but also accepts afilterpredicate.This method is intended for aggregate functions.
- Specified by:
generateAggregateSqmExpressionin interfaceSqmFunctionDescriptor
-
generateOrderedSetAggregateSqmExpression
public <T> SelfRenderingSqmFunction<T> generateOrderedSetAggregateSqmExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, SqmOrderByClause withinGroupClause, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Description copied from interface:SqmFunctionDescriptorLikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine), but also accepts afilterpredicate and anorder byclause.This method is intended for ordered set aggregate functions.
- Specified by:
generateOrderedSetAggregateSqmExpressionin 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:SqmFunctionDescriptorLikeSqmFunctionDescriptor.generateSqmExpression(List, ReturnableType, QueryEngine)but also accepts afilterpredicate.This method is intended for window functions.
- Specified by:
generateWindowSqmExpressionin interfaceSqmFunctionDescriptor
-
getArgumentsValidator
public ArgumentsValidator getArgumentsValidator()
Description copied from interface:SqmFunctionDescriptorThe object responsible for validating arguments of the function.- Specified by:
getArgumentsValidatorin interfaceSqmFunctionDescriptor- Returns:
- an instance of
ArgumentsValidator
-
validate
public void validate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration)
Description copied from interface:ArgumentsValidatorPerform validation that may be done using theSqmTypedNodetree and assigned Java types.- Specified by:
validatein interfaceArgumentsValidator
-
-