Top Description Fields Constructors Methods
org.hibernate.query.sqm.function

public Class SqmFunctionRegistry

extends Object
Class Inheritance
Imports
java.util.Map, .Set, .TreeMap, java.util.stream.Stream, org.hibernate.internal.util.collections.CaseInsensitiveDictionary, org.hibernate.query.sqm.produce.function.FunctionParameterType, .NamedFunctionDescriptorBuilder, .PatternFunctionDescriptorBuilder, org.hibernate.type.BasicType, org.hibernate.type.spi.TypeConfiguration, org.jboss.logging.Logger

Defines a registry for SqmFunctionDescriptor instances.

The SqmFunctionRegistry may be configured by a org.hibernate.boot.model.FunctionContributor.

Author
Steve Ebersole
See Also
org.hibernate.boot.model.FunctionContributor, org.hibernate.boot.model.FunctionContributions

Field Summary

Modifier and TypeField and Description
private final CaseInsensitiveDictionary<String>
private final CaseInsensitiveDictionary<SqmFunctionDescriptor>
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public SqmFunctionDescriptor
findFunctionDescriptor(String functionName)

Find a SqmFunctionTemplate by name.

public Stream<Map.Entry<String, SqmFunctionDescriptor>>
getFunctionsByName()

Useful for diagnostics - not efficient: do not use in production code.

public Set<String>
public NamedFunctionDescriptorBuilder

Returns:

The builder
namedAggregateDescriptorBuilder
(String
The function name (and registration key)
name
)

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

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedAggregateDescriptorBuilder
(String
The name under which the descriptor will get registered
registrationKey
,
String
The underlying SQL function name to use
name
)

Get a builder for creating and registering a name-based aggregate function descriptor.

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedDescriptorBuilder
(String
The function name (and registration key)
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 name

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedDescriptorBuilder
(String
The name under which the descriptor will get registered
registrationKey
,
String
The underlying SQL function name to use
name
)

Get a builder for creating and registering a name-based function descriptor.

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedOrderedSetAggregateDescriptorBuilder
(String
The function name (and registration key)
name
)

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

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedOrderedSetAggregateDescriptorBuilder
(String
The name under which the descriptor will get registered
registrationKey
,
String
The underlying SQL function name to use
name
)

Get a builder for creating and registering a name-based ordered set-aggregate function descriptor.

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedWindowDescriptorBuilder
(String
The function name (and registration key)
name
)

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

public NamedFunctionDescriptorBuilder

Returns:

The builder
namedWindowDescriptorBuilder
(String
The name under which the descriptor will get registered
registrationKey
,
String
The underlying SQL function name to use
name
)

Get a builder for creating and registering a name-based window function descriptor.

public NamedFunctionDescriptorBuilder
public NamedFunctionDescriptorBuilder
noArgsBuilder(String registrationKey, String name)

public void
overlay(SqmFunctionRegistry registryToOverly)

Overlay the functions registered here on top of the incoming registry, potentially overriding its registrations

public PatternFunctionDescriptorBuilder

Returns:

The builder
patternAggregateDescriptorBuilder
(String
The name under which the descriptor will get registered
registrationKey
,
String
The pattern defining the underlying function call
pattern
)

Get a builder for creating and registering a pattern-based aggregate function descriptor.

public PatternFunctionDescriptorBuilder

Returns:

The builder
patternDescriptorBuilder
(String
The name under which the descriptor will get registered
registrationKey
,
String
The pattern defining the underlying function call
pattern
)

Get a builder for creating and registering a pattern-based function descriptor.

public SqmFunctionDescriptor
register(String registrationKey, SqmFunctionDescriptor function)

Register a function descriptor by name

public void
registerAlternateKey(String alternateKey, String mappedKey)

public MultipatternSqmFunctionDescriptor
registerBinaryTernaryPattern(String name, BasicType<?> type, String pattern2, String pattern3, FunctionParameterType parameterType1, FunctionParameterType parameterType2, FunctionParameterType parameterType3, TypeConfiguration typeConfiguration)

Register a binary/ternary function.

public SqmFunctionDescriptor
registerNamed(String
The function name (and registration key)
name
)

Register a named descriptor by name.

public SqmFunctionDescriptor
registerNamed(String
The function name (and registration key)
name
,
BasicType<T> returnType)

Register a named descriptor by name and invariant return type.

public SqmFunctionDescriptor
registerNoArgs(String
The function name (and registration key)
name
)

Specialized registration method for registering a named descriptor for functions expecting zero arguments.

public SqmFunctionDescriptor
registerNoArgs(String registrationKey, String name)

public SqmFunctionDescriptor
registerNoArgs(String name, BasicType<T> returnType)

public SqmFunctionDescriptor
registerNoArgs(String registrationKey, String name, BasicType<T> returnType)

public MultipatternSqmFunctionDescriptor
registerNullaryUnaryPattern(String name, BasicType<T> type, String pattern0, String pattern1, FunctionParameterType parameterType, TypeConfiguration typeConfiguration)

Register a nullary/unary function.

public SqmFunctionDescriptor
registerPattern(String name, String pattern)

Register a pattern-based descriptor by name.

public SqmFunctionDescriptor
registerPattern(String name, String pattern, BasicType<T> returnType)

Register a pattern-based descriptor by name and invariant return type.

private MultipatternSqmFunctionDescriptor
registerPatterns(String name, FunctionParameterType[] parameterTypes, TypeConfiguration typeConfiguration, String... patterns)

private MultipatternSqmFunctionDescriptor
registerPatterns(String name, BasicType<?> type, FunctionParameterType[] parameterTypes, TypeConfiguration typeConfiguration, String... patterns)

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.

public MultipatternSqmFunctionDescriptor
registerUnaryBinaryPattern(String name, String pattern1, String pattern2, FunctionParameterType parameterType1, FunctionParameterType parameterType2, TypeConfiguration typeConfiguration)

Register a unary/binary function.

public MultipatternSqmFunctionDescriptor
registerUnaryBinaryPattern(String name, BasicType<?> type, String pattern1, String pattern2, FunctionParameterType parameterType1, FunctionParameterType parameterType2, TypeConfiguration typeConfiguration)

Register a unary/binary function.

public SqmFunctionDescriptor
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alternateKeyMapback to summary
private final CaseInsensitiveDictionary<String> alternateKeyMap
functionMapback to summary
private final CaseInsensitiveDictionary<SqmFunctionDescriptor> functionMap
logback to summary
private static final Logger log

Constructor Detail

SqmFunctionRegistryback to summary
public SqmFunctionRegistry()

Method Detail

closeback to summary
public void close()
findFunctionDescriptorback to summary
public SqmFunctionDescriptor findFunctionDescriptor(String functionName)

Find a SqmFunctionTemplate by name. Returns null if no such function is found.

getFunctionsByNameback to summary
public Stream<Map.Entry<String, SqmFunctionDescriptor>> getFunctionsByName()

Useful for diagnostics - not efficient: do not use in production code.

getValidFunctionKeysback to summary
public Set<String> getValidFunctionKeys()
namedAggregateDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedAggregateDescriptorBuilder(String name)

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:String

The function name (and registration key)

Returns:NamedFunctionDescriptorBuilder

The builder

namedAggregateDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedAggregateDescriptorBuilder(String registrationKey, String name)

Get a builder for creating and registering a name-based aggregate function descriptor.

Parameters
registrationKey:String

The name under which the descriptor will get registered

name:String

The underlying SQL function name to use

Returns:NamedFunctionDescriptorBuilder

The builder

namedDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder 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 name

Parameters
name:String

The function name (and registration key)

Returns:NamedFunctionDescriptorBuilder

The builder

namedDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedDescriptorBuilder(String registrationKey, String name)

Get a builder for creating and registering a name-based function descriptor.

Parameters
registrationKey:String

The name under which the descriptor will get registered

name:String

The underlying SQL function name to use

Returns:NamedFunctionDescriptorBuilder

The builder

namedOrderedSetAggregateDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedOrderedSetAggregateDescriptorBuilder(String name)

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:String

The function name (and registration key)

Returns:NamedFunctionDescriptorBuilder

The builder

namedOrderedSetAggregateDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedOrderedSetAggregateDescriptorBuilder(String registrationKey, String name)

Get a builder for creating and registering a name-based ordered set-aggregate function descriptor.

Parameters
registrationKey:String

The name under which the descriptor will get registered

name:String

The underlying SQL function name to use

Returns:NamedFunctionDescriptorBuilder

The builder

namedWindowDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedWindowDescriptorBuilder(String name)

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:String

The function name (and registration key)

Returns:NamedFunctionDescriptorBuilder

The builder

namedWindowDescriptorBuilderback to summary
public NamedFunctionDescriptorBuilder namedWindowDescriptorBuilder(String registrationKey, String name)

Get a builder for creating and registering a name-based window function descriptor.

Parameters
registrationKey:String

The name under which the descriptor will get registered

name:String

The underlying SQL function name to use

Returns:NamedFunctionDescriptorBuilder

The builder

noArgsBuilderback to summary
public NamedFunctionDescriptorBuilder noArgsBuilder(String name)
noArgsBuilderback to summary
public NamedFunctionDescriptorBuilder noArgsBuilder(String registrationKey, String name)
overlayback to summary
public void overlay(SqmFunctionRegistry registryToOverly)

Overlay the functions registered here on top of the incoming registry, potentially overriding its registrations

patternAggregateDescriptorBuilderback to summary
public PatternFunctionDescriptorBuilder patternAggregateDescriptorBuilder(String registrationKey, String pattern)

Get a builder for creating and registering a pattern-based aggregate function descriptor.

Parameters
registrationKey:String

The name under which the descriptor will get registered

pattern:String

The pattern defining the underlying function call

Returns:PatternFunctionDescriptorBuilder

The builder

patternDescriptorBuilderback to summary
public PatternFunctionDescriptorBuilder patternDescriptorBuilder(String registrationKey, String pattern)

Get a builder for creating and registering a pattern-based function descriptor.

Parameters
registrationKey:String

The name under which the descriptor will get registered

pattern:String

The pattern defining the underlying function call

Returns:PatternFunctionDescriptorBuilder

The builder

registerback to summary
public SqmFunctionDescriptor register(String registrationKey, SqmFunctionDescriptor function)

Register a function descriptor by name

registerAlternateKeyback to summary
public void registerAlternateKey(String alternateKey, String mappedKey)
registerBinaryTernaryPatternback to summary
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.

registerNamedback to summary
public SqmFunctionDescriptor registerNamed(String name)

Register a named descriptor by name. Shortcut for building a descriptor via namedDescriptorBuilder using the passed name as both the registration key and underlying SQL function name and accepting the builder's defaults.

Parameters
name:String

The function name (and registration key)

registerNamedback to summary
public SqmFunctionDescriptor registerNamed(String name, BasicType<T> returnType)

Register a named descriptor by name and invariant return type. Shortcut for building a descriptor via namedDescriptorBuilder using the passed name as both the registration key and underlying SQL function name and accepting the builder's defaults.

Parameters
name:String

The function name (and registration key)

registerNoArgsback to summary
public SqmFunctionDescriptor registerNoArgs(String name)

Specialized registration method for registering a named descriptor for functions expecting zero arguments. Short-cut for building a named descriptor via namedDescriptorBuilder specifying zero arguments and accepting the rest of the builder's defaults.

Parameters
name:String

The function name (and registration key)

registerNoArgsback to summary
public SqmFunctionDescriptor registerNoArgs(String registrationKey, String name)
registerNoArgsback to summary
public SqmFunctionDescriptor registerNoArgs(String name, BasicType<T> returnType)
registerNoArgsback to summary
public SqmFunctionDescriptor registerNoArgs(String registrationKey, String name, BasicType<T> returnType)
registerNullaryUnaryPatternback to summary
public MultipatternSqmFunctionDescriptor registerNullaryUnaryPattern(String name, BasicType<T> type, String pattern0, String pattern1, FunctionParameterType parameterType, TypeConfiguration typeConfiguration)

Register a nullary/unary function. i.e. a function which accepts 0-1 arguments.

registerPatternback to summary
public SqmFunctionDescriptor registerPattern(String name, String pattern)

Register a pattern-based descriptor by name. Shortcut for building the descriptor via patternDescriptorBuilder accepting its defaults.

registerPatternback to summary
public SqmFunctionDescriptor registerPattern(String name, String pattern, BasicType<T> returnType)

Register a pattern-based descriptor by name and invariant return type. Shortcut for building the descriptor via patternDescriptorBuilder accepting its defaults.

registerPatternsback to summary
private MultipatternSqmFunctionDescriptor registerPatterns(String name, FunctionParameterType[] parameterTypes, TypeConfiguration typeConfiguration, String... patterns)
registerPatternsback to summary
private MultipatternSqmFunctionDescriptor registerPatterns(String name, BasicType<?> type, FunctionParameterType[] parameterTypes, TypeConfiguration typeConfiguration, String... patterns)
registerTernaryQuaternaryPatternback to summary
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.

registerUnaryBinaryPatternback to summary
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.

registerUnaryBinaryPatternback to summary
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.

wrapInJdbcEscapeback to summary
public SqmFunctionDescriptor wrapInJdbcEscape(String name, SqmFunctionDescriptor wrapped)