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 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.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 afilter
predicate.String
getArgumentListSignature()
ArgumentsValidator
getArgumentsValidator()
The object responsible for validating arguments of the function.FunctionArgumentTypeResolver
getArgumentTypeResolver()
String
getName()
String
getReturnSignature()
FunctionReturnTypeResolver
getReturnTypeResolver()
String
getSignature(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:SqmFunctionDescriptor
Used only for pretty-printing the function signature in the log.- Specified by:
getSignature
in interfaceSqmFunctionDescriptor
- Parameters:
name
- the function name- Returns:
- the signature of the function
-
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
-
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: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 final <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 final <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 final <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
-
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
-
-