Package org.hibernate.query.sqm.function
Class AbstractSqmFunctionDescriptor
- java.lang.Object
-
- org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor
-
- All Implemented Interfaces:
SqmFunctionDescriptor
- Direct Known Subclasses:
AbstractSqmSelfRenderingFunctionDescriptor,CastStrEmulation,CoalesceIfnullEmulation,DateTruncEmulation,ExtractFunction,FormatFunction,InsertSubstringOverlayEmulation,JdbcEscapeFunctionDescriptor,LocatePositionEmulation,LpadRpadPadEmulation,MultipatternSqmFunctionDescriptor,NvlCoalesceEmulation,OrderByFragmentFunction,PostgreSQLTruncRoundFunction,TruncFunction
public abstract class AbstractSqmFunctionDescriptor extends Object implements SqmFunctionDescriptor
-
-
Constructor Summary
Constructors Constructor Description AbstractSqmFunctionDescriptor(String name)AbstractSqmFunctionDescriptor(String name, ArgumentsValidator argumentsValidator)AbstractSqmFunctionDescriptor(String name, ArgumentsValidator argumentsValidator, FunctionArgumentTypeResolver argumentTypeResolver)AbstractSqmFunctionDescriptor(String name, ArgumentsValidator argumentsValidator, FunctionReturnTypeResolver returnTypeResolver, FunctionArgumentTypeResolver argumentTypeResolver)
-
Method Summary
All Methods Instance Methods Abstract 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.protected <T> SelfRenderingSqmAggregateFunction<T>generateSqmAggregateFunctionExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, ReturnableType<T> impliedResultType, QueryEngine queryEngine)Return an SQM node or subtree representing an invocation of this aggregate function with the given arguments.<T> SelfRenderingSqmFunction<T>generateSqmExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)Instantiate this template with the given arguments and expected return type.protected abstract <T> SelfRenderingSqmFunction<T>generateSqmFunctionExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)Return an SQM node or subtree representing an invocation of this function with the given arguments.protected <T> SelfRenderingSqmAggregateFunction<T>generateSqmOrderedSetAggregateFunctionExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, SqmOrderByClause withinGroupClause, ReturnableType<T> impliedResultType, QueryEngine queryEngine)Return an SQM node or subtree representing an invocation of this ordered set-aggregate function with the given arguments.protected <T> SelfRenderingSqmWindowFunction<T>generateSqmWindowFunctionExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, Boolean respectNulls, Boolean fromFirst, ReturnableType<T> impliedResultType, QueryEngine queryEngine)Return an SQM node or subtree representing an invocation of this window function with the given arguments.<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.StringgetArgumentListSignature()ArgumentsValidatorgetArgumentsValidator()The object responsible for validating arguments of the function.FunctionArgumentTypeResolvergetArgumentTypeResolver()StringgetName()StringgetReturnSignature()FunctionReturnTypeResolvergetReturnTypeResolver()StringgetSignature(String name)Used only for pretty-printing the function signature in the log.-
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.function.SqmFunctionDescriptor
alwaysIncludesParentheses, generateSqmExpression, generateSqmExpression, getFunctionKind
-
-
-
-
Constructor Detail
-
AbstractSqmFunctionDescriptor
public AbstractSqmFunctionDescriptor(String name)
-
AbstractSqmFunctionDescriptor
public AbstractSqmFunctionDescriptor(String name, ArgumentsValidator argumentsValidator)
-
AbstractSqmFunctionDescriptor
public AbstractSqmFunctionDescriptor(String name, ArgumentsValidator argumentsValidator, FunctionArgumentTypeResolver argumentTypeResolver)
-
AbstractSqmFunctionDescriptor
public AbstractSqmFunctionDescriptor(String name, ArgumentsValidator argumentsValidator, FunctionReturnTypeResolver returnTypeResolver, FunctionArgumentTypeResolver argumentTypeResolver)
-
-
Method Detail
-
getName
public String getName()
-
getSignature
public String getSignature(String name)
Description copied from interface:SqmFunctionDescriptorUsed only for pretty-printing the function signature in the log.- Specified by:
getSignaturein interfaceSqmFunctionDescriptor- Parameters:
name- the function name- Returns:
- the signature of the function
-
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
-
getReturnTypeResolver
public FunctionReturnTypeResolver getReturnTypeResolver()
-
getArgumentTypeResolver
public FunctionArgumentTypeResolver getArgumentTypeResolver()
-
getReturnSignature
public String getReturnSignature()
-
getArgumentListSignature
public String getArgumentListSignature()
-
generateSqmExpression
public final <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 final <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 final <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 final <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
-
generateSqmFunctionExpression
protected abstract <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Return an SQM node or subtree representing an invocation of this function with the given arguments. This method may be overridden in the case of function descriptors that wish to customize creation of the node.- Parameters:
arguments- the arguments of the function invocationimpliedResultType- the function return type as inferred from its usage
-
generateSqmAggregateFunctionExpression
protected <T> SelfRenderingSqmAggregateFunction<T> generateSqmAggregateFunctionExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Return an SQM node or subtree representing an invocation of this aggregate function with the given arguments. This method may be overridden in the case of function descriptors that wish to customize creation of the node.- Parameters:
arguments- the arguments of the function invocationimpliedResultType- the function return type as inferred from its usage
-
generateSqmOrderedSetAggregateFunctionExpression
protected <T> SelfRenderingSqmAggregateFunction<T> generateSqmOrderedSetAggregateFunctionExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, SqmOrderByClause withinGroupClause, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Return an SQM node or subtree representing an invocation of this ordered set-aggregate function with the given arguments. This method may be overridden in the case of function descriptors that wish to customize creation of the node.- Parameters:
arguments- the arguments of the function invocationimpliedResultType- the function return type as inferred from its usage
-
generateSqmWindowFunctionExpression
protected <T> SelfRenderingSqmWindowFunction<T> generateSqmWindowFunctionExpression(List<? extends SqmTypedNode<?>> arguments, SqmPredicate filter, Boolean respectNulls, Boolean fromFirst, ReturnableType<T> impliedResultType, QueryEngine queryEngine)
Return an SQM node or subtree representing an invocation of this window function with the given arguments. This method may be overridden in the case of function descriptors that wish to customize creation of the node.- Parameters:
arguments- the arguments of the function invocationrespectNulls-fromFirst-impliedResultType- the function return type as inferred from its usage
-
-