Package org.hibernate.query.sqm.function
Class SqmFunctionRegistry
java.lang.Object
org.hibernate.query.sqm.function.SqmFunctionRegistry
Defines a registry for
SqmFunctionDescriptor
instances.
The SqmFunctionRegistry
may be configured by a FunctionContributor
.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
findFunctionDescriptor
(String functionName) Find a SqmFunctionTemplate by name.Useful for diagnostics - not efficient: do not use in production code.Get a builder for creating and registering a name-based aggregate function descriptor using the passed name as both the registration key and underlying SQL function namenamedAggregateDescriptorBuilder
(String registrationKey, String name) Get a builder for creating and registering a name-based aggregate function descriptor.namedDescriptorBuilder
(String name) Get a builder for creating and registering a name-based function descriptor using the passed name as both the registration key and underlying SQL function namenamedDescriptorBuilder
(String registrationKey, String name) Get a builder for creating and registering a name-based function descriptor.Get a builder for creating and registering a name-based ordered set-aggregate function descriptor using the passed name as both the registration key and underlying SQL function namenamedOrderedSetAggregateDescriptorBuilder
(String registrationKey, String name) Get a builder for creating and registering a name-based ordered set-aggregate function descriptor.Get a builder for creating and registering a name-based window function descriptor using the passed name as both the registration key and underlying SQL function namenamedWindowDescriptorBuilder
(String registrationKey, String name) Get a builder for creating and registering a name-based window function descriptor.noArgsBuilder
(String name) noArgsBuilder
(String registrationKey, String name) void
overlay
(SqmFunctionRegistry registryToOverly) Overlay the functions registered here on top of the incoming registry, potentially overriding its registrationspatternAggregateDescriptorBuilder
(String registrationKey, String pattern) Get a builder for creating and registering a pattern-based aggregate function descriptor.patternDescriptorBuilder
(String registrationKey, String pattern) Get a builder for creating and registering a pattern-based function descriptor.register
(String registrationKey, SqmFunctionDescriptor function) Register a function descriptor by namevoid
registerAlternateKey
(String alternateKey, String mappedKey) registerBinaryTernaryPattern
(String name, BasicType<?> type, String pattern2, String pattern3, FunctionParameterType parameterType1, FunctionParameterType parameterType2, FunctionParameterType parameterType3, TypeConfiguration typeConfiguration) Register a binary/ternary function.registerNamed
(String name) Register a named descriptor by name.registerNamed
(String name, BasicType returnType) Register a named descriptor by name and invariant return type.registerNoArgs
(String name) Specialized registration method for registering a named descriptor for functions expecting zero arguments.registerNoArgs
(String registrationKey, String name) registerNoArgs
(String registrationKey, String name, BasicType returnType) registerNoArgs
(String name, BasicType returnType) registerNullaryUnaryPattern
(String name, BasicType type, String pattern0, String pattern1, FunctionParameterType parameterType, TypeConfiguration typeConfiguration) Register a nullary/unary function.registerPattern
(String name, String pattern) Register a pattern-based descriptor by name.registerPattern
(String name, String pattern, BasicType returnType) Register a pattern-based descriptor by name and invariant return type.registerTernaryQuaternaryPattern
(String name, BasicType<?> type, String pattern3, String pattern4, FunctionParameterType parameterType1, FunctionParameterType parameterType2, FunctionParameterType parameterType3, FunctionParameterType parameterType4, TypeConfiguration typeConfiguration) Register a ternary/quaternary function.registerUnaryBinaryPattern
(String name, String pattern1, String pattern2, FunctionParameterType parameterType1, FunctionParameterType parameterType2, TypeConfiguration typeConfiguration) Register a unary/binary function.registerUnaryBinaryPattern
(String name, BasicType<?> type, String pattern1, String pattern2, FunctionParameterType parameterType1, FunctionParameterType parameterType2, TypeConfiguration typeConfiguration) Register a unary/binary function.wrapInJdbcEscape
(String name, SqmFunctionDescriptor wrapped)
-
Constructor Details
-
SqmFunctionRegistry
public SqmFunctionRegistry()
-
-
Method Details
-
getValidFunctionKeys
-
getFunctionsByName
Useful for diagnostics - not efficient: do not use in production code.- Returns:
-
findFunctionDescriptor
Find a SqmFunctionTemplate by name. Returnsnull
if no such function is found. -
register
Register a function descriptor by name -
registerPattern
Register a pattern-based descriptor by name. Shortcut for building the descriptor viapatternDescriptorBuilder(java.lang.String, java.lang.String)
accepting its defaults. -
registerPattern
Register a pattern-based descriptor by name and invariant return type. Shortcut for building the descriptor viapatternDescriptorBuilder(java.lang.String, java.lang.String)
accepting its defaults. -
patternDescriptorBuilder
public PatternFunctionDescriptorBuilder patternDescriptorBuilder(String registrationKey, String pattern) Get a builder for creating and registering a pattern-based function descriptor.- Parameters:
registrationKey
- The name under which the descriptor will get registeredpattern
- The pattern defining the underlying function call- Returns:
- The builder
-
patternAggregateDescriptorBuilder
public PatternFunctionDescriptorBuilder patternAggregateDescriptorBuilder(String registrationKey, String pattern) Get a builder for creating and registering a pattern-based aggregate function descriptor.- Parameters:
registrationKey
- The name under which the descriptor will get registeredpattern
- The pattern defining the underlying function call- Returns:
- The builder
-
registerNamed
Register a named descriptor by name. Shortcut for building a descriptor vianamedDescriptorBuilder(java.lang.String)
using the passed name as both the registration key and underlying SQL function name and accepting the builder's defaults.- Parameters:
name
- The function name (and registration key)
-
registerNamed
Register a named descriptor by name and invariant return type. Shortcut for building a descriptor vianamedDescriptorBuilder(java.lang.String)
using the passed name as both the registration key and underlying SQL function name and accepting the builder's defaults.- Parameters:
name
- The function name (and registration key)
-
namedDescriptorBuilder
Get a builder for creating and registering a name-based function descriptor using the passed name as both the registration key and underlying SQL function name- Parameters:
name
- The function name (and registration key)- Returns:
- The builder
-
namedAggregateDescriptorBuilder
Get a builder for creating and registering a name-based aggregate function descriptor using the passed name as both the registration key and underlying SQL function name- Parameters:
name
- The function name (and registration key)- Returns:
- The builder
-
namedOrderedSetAggregateDescriptorBuilder
Get a builder for creating and registering a name-based ordered set-aggregate function descriptor using the passed name as both the registration key and underlying SQL function name- Parameters:
name
- The function name (and registration key)- Returns:
- The builder
-
namedWindowDescriptorBuilder
Get a builder for creating and registering a name-based window function descriptor using the passed name as both the registration key and underlying SQL function name- Parameters:
name
- The function name (and registration key)- Returns:
- The builder
-
namedDescriptorBuilder
Get a builder for creating and registering a name-based function descriptor.- Parameters:
registrationKey
- The name under which the descriptor will get registeredname
- The underlying SQL function name to use- Returns:
- The builder
-
namedAggregateDescriptorBuilder
public NamedFunctionDescriptorBuilder namedAggregateDescriptorBuilder(String registrationKey, String name) Get a builder for creating and registering a name-based aggregate function descriptor.- Parameters:
registrationKey
- The name under which the descriptor will get registeredname
- The underlying SQL function name to use- Returns:
- The builder
-
namedOrderedSetAggregateDescriptorBuilder
public NamedFunctionDescriptorBuilder namedOrderedSetAggregateDescriptorBuilder(String registrationKey, String name) Get a builder for creating and registering a name-based ordered set-aggregate function descriptor.- Parameters:
registrationKey
- The name under which the descriptor will get registeredname
- The underlying SQL function name to use- Returns:
- The builder
-
namedWindowDescriptorBuilder
public NamedFunctionDescriptorBuilder namedWindowDescriptorBuilder(String registrationKey, String name) Get a builder for creating and registering a name-based window function descriptor.- Parameters:
registrationKey
- The name under which the descriptor will get registeredname
- The underlying SQL function name to use- Returns:
- The builder
-
noArgsBuilder
-
noArgsBuilder
-
registerNoArgs
Specialized registration method for registering a named descriptor for functions expecting zero arguments. Short-cut for building a named descriptor vianamedDescriptorBuilder(java.lang.String)
specifying zero arguments and accepting the rest of the builder's defaults.- Parameters:
name
- The function name (and registration key)
-
registerNoArgs
-
registerNoArgs
-
registerNoArgs
public SqmFunctionDescriptor registerNoArgs(String registrationKey, String name, BasicType returnType) -
wrapInJdbcEscape
-
registerAlternateKey
-
registerNullaryUnaryPattern
public MultipatternSqmFunctionDescriptor registerNullaryUnaryPattern(String name, BasicType type, String pattern0, String pattern1, FunctionParameterType parameterType, TypeConfiguration typeConfiguration) Register a nullary/unary function. i.e. a function which accepts 0-1 arguments. -
registerUnaryBinaryPattern
public MultipatternSqmFunctionDescriptor registerUnaryBinaryPattern(String name, String pattern1, String pattern2, FunctionParameterType parameterType1, FunctionParameterType parameterType2, TypeConfiguration typeConfiguration) Register a unary/binary function. i.e. a function which accepts 1-2 arguments. -
registerUnaryBinaryPattern
public MultipatternSqmFunctionDescriptor registerUnaryBinaryPattern(String name, BasicType<?> type, String pattern1, String pattern2, FunctionParameterType parameterType1, FunctionParameterType parameterType2, TypeConfiguration typeConfiguration) Register a unary/binary function. i.e. a function which accepts 1-2 arguments. -
registerBinaryTernaryPattern
public MultipatternSqmFunctionDescriptor registerBinaryTernaryPattern(String name, BasicType<?> type, String pattern2, String pattern3, FunctionParameterType parameterType1, FunctionParameterType parameterType2, FunctionParameterType parameterType3, TypeConfiguration typeConfiguration) Register a binary/ternary function. i.e. a function which accepts 2-3 arguments. -
registerTernaryQuaternaryPattern
public MultipatternSqmFunctionDescriptor registerTernaryQuaternaryPattern(String name, BasicType<?> type, String pattern3, String pattern4, FunctionParameterType parameterType1, FunctionParameterType parameterType2, FunctionParameterType parameterType3, FunctionParameterType parameterType4, TypeConfiguration typeConfiguration) Register a ternary/quaternary function. i.e. a function which accepts 3-4 arguments. -
overlay
Overlay the functions registered here on top of the incoming registry, potentially overriding its registrations -
close
public void close()
-