@@ -1103,8 +1103,8 @@ public int ordinal() {
11031103 * functions with the same names.
11041104 */
11051105 public void initializeFunctionRegistry (FunctionContributions functionContributions ) {
1106- final TypeConfiguration typeConfiguration = functionContributions .getTypeConfiguration ();
1107- final BasicTypeRegistry basicTypeRegistry = typeConfiguration .getBasicTypeRegistry ();
1106+ final var typeConfiguration = functionContributions .getTypeConfiguration ();
1107+ final var basicTypeRegistry = typeConfiguration .getBasicTypeRegistry ();
11081108 final BasicType <Date > timestampType = basicTypeRegistry .resolve ( StandardBasicTypes .TIMESTAMP );
11091109 final BasicType <Date > dateType = basicTypeRegistry .resolve ( StandardBasicTypes .DATE );
11101110 final BasicType <Date > timeType = basicTypeRegistry .resolve ( StandardBasicTypes .TIME );
@@ -1114,6 +1114,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
11141114 final BasicType <LocalTime > localTimeType = basicTypeRegistry .resolve ( StandardBasicTypes .LOCAL_TIME );
11151115 final BasicType <LocalDate > localDateType = basicTypeRegistry .resolve ( StandardBasicTypes .LOCAL_DATE );
11161116
1117+ final var functionRegistry = functionContributions .getFunctionRegistry ();
11171118 final var functionFactory = new CommonFunctionFactory ( functionContributions );
11181119
11191120 //standard aggregate functions count(), sum(), max(), min(), avg(),
@@ -1196,20 +1197,20 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
11961197 //only some databases support the ANSI SQL-style position() function, so
11971198 //define it here as an alias for locate()
11981199
1199- functionContributions . getFunctionRegistry () .register ( "position" ,
1200+ functionRegistry .register ( "position" ,
12001201 new LocatePositionEmulation ( typeConfiguration ) );
12011202
12021203 //very few databases support ANSI-style overlay() function, so emulate
12031204 //it here in terms of either insert() or concat()/substring()
12041205
1205- functionContributions . getFunctionRegistry () .register ( "overlay" ,
1206+ functionRegistry .register ( "overlay" ,
12061207 new InsertSubstringOverlayEmulation ( typeConfiguration , false ) );
12071208
12081209 //ANSI SQL trim() function is supported on almost all of the databases
12091210 //we care about, but on some it must be emulated using ltrim(), rtrim(),
12101211 //and replace()
12111212
1212- functionContributions . getFunctionRegistry () .register ( "trim" ,
1213+ functionRegistry .register ( "trim" ,
12131214 new TrimFunction ( this , typeConfiguration ) );
12141215
12151216 //ANSI SQL cast() function is supported on the databases we care most
@@ -1220,7 +1221,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
12201221 // - casts to and from Boolean, and
12211222 // - casting Double or Float to String.
12221223
1223- functionContributions . getFunctionRegistry () .register (
1224+ functionRegistry .register (
12241225 "cast" ,
12251226 new CastFunction (
12261227 this ,
@@ -1239,7 +1240,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
12391240 //additional non-standard temporal field types, which must be emulated in
12401241 //a very dialect-specific way
12411242
1242- functionContributions . getFunctionRegistry () .register ( "extract" ,
1243+ functionRegistry .register ( "extract" ,
12431244 new ExtractFunction ( this , typeConfiguration ) );
12441245
12451246 //comparison functions supported on most databases, emulated on others
@@ -1250,7 +1251,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
12501251 //two-argument synonym for coalesce() supported on most but not every
12511252 //database, so define it here as an alias for coalesce(arg1,arg2)
12521253
1253- functionContributions . getFunctionRegistry () .register ( "ifnull" ,
1254+ functionRegistry .register ( "ifnull" ,
12541255 new CoalesceIfnullEmulation () );
12551256
12561257 //rpad() and pad() are supported on almost every database, and emulated
@@ -1261,23 +1262,23 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
12611262
12621263 //pad() is a function we've designed to look like ANSI trim()
12631264
1264- functionContributions . getFunctionRegistry () .register ( "pad" ,
1265+ functionRegistry .register ( "pad" ,
12651266 new LpadRpadPadEmulation ( typeConfiguration ) );
12661267
12671268 //legacy Hibernate convenience function for casting to string, defined
12681269 //here as an alias for cast(arg as String)
12691270
1270- functionContributions . getFunctionRegistry () .register ( "str" ,
1271+ functionRegistry .register ( "str" ,
12711272 new CastStrEmulation ( typeConfiguration ) );
12721273
12731274 // Function to convert enum mapped as Ordinal to their ordinal value
12741275
1275- functionContributions . getFunctionRegistry () .register ( "ordinal" ,
1276+ functionRegistry .register ( "ordinal" ,
12761277 new OrdinalFunction ( typeConfiguration ) );
12771278
12781279 // Function to convert enum mapped as String to their string value
12791280
1280- functionContributions . getFunctionRegistry () .register ( "string" ,
1281+ functionRegistry .register ( "string" ,
12811282 new StringFunction ( typeConfiguration ) );
12821283
12831284 //format() function for datetimes, emulated on many databases using the
@@ -1290,89 +1291,89 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
12901291 //since there is a great variety of different ways to emulate them
12911292 //by default, we don't allow plain parameters for the timestamp argument as most database don't support this
12921293 functionFactory .timestampaddAndDiff ( this , SqlAstNodeRenderingMode .NO_PLAIN_PARAMETER );
1293- functionContributions . getFunctionRegistry () .registerAlternateKey ( "dateadd" , "timestampadd" );
1294- functionContributions . getFunctionRegistry () .registerAlternateKey ( "datediff" , "timestampdiff" );
1294+ functionRegistry .registerAlternateKey ( "dateadd" , "timestampadd" );
1295+ functionRegistry .registerAlternateKey ( "datediff" , "timestampdiff" );
12951296
12961297 //ANSI SQL (and JPA) current date/time/timestamp functions, supported
12971298 //natively on almost every database, delegated back to the Dialect
12981299
1299- functionContributions . getFunctionRegistry () .register (
1300+ functionRegistry .register (
13001301 "current_date" ,
13011302 new CurrentFunction (
13021303 "current_date" ,
13031304 currentDate (),
13041305 dateType
13051306 )
13061307 );
1307- functionContributions . getFunctionRegistry () .register (
1308+ functionRegistry .register (
13081309 "current_time" ,
13091310 new CurrentFunction (
13101311 "current_time" ,
13111312 currentTime (),
13121313 timeType
13131314 )
13141315 );
1315- functionContributions . getFunctionRegistry () .register (
1316+ functionRegistry .register (
13161317 "current_timestamp" ,
13171318 new CurrentFunction (
13181319 "current_timestamp" ,
13191320 currentTimestamp (),
13201321 timestampType
13211322 )
13221323 );
1323- functionContributions . getFunctionRegistry () .registerAlternateKey ( "current date" , "current_date" );
1324- functionContributions . getFunctionRegistry () .registerAlternateKey ( "current time" , "current_time" );
1325- functionContributions . getFunctionRegistry () .registerAlternateKey ( "current timestamp" , "current_timestamp" );
1324+ functionRegistry .registerAlternateKey ( "current date" , "current_date" );
1325+ functionRegistry .registerAlternateKey ( "current time" , "current_time" );
1326+ functionRegistry .registerAlternateKey ( "current timestamp" , "current_timestamp" );
13261327 //HQL current instant/date/time/datetime functions, delegated back to the Dialect
13271328
1328- functionContributions . getFunctionRegistry () .register (
1329+ functionRegistry .register (
13291330 "local_date" ,
13301331 new CurrentFunction (
13311332 "local_date" ,
13321333 currentDate (),
13331334 localDateType
13341335 )
13351336 );
1336- functionContributions . getFunctionRegistry () .register (
1337+ functionRegistry .register (
13371338 "local_time" ,
13381339 new CurrentFunction (
13391340 "local_time" ,
13401341 currentLocalTime (),
13411342 localTimeType
13421343 )
13431344 );
1344- functionContributions . getFunctionRegistry () .register (
1345+ functionRegistry .register (
13451346 "local_datetime" ,
13461347 new CurrentFunction (
13471348 "local_datetime" ,
13481349 currentLocalTimestamp (),
13491350 localDateTimeType
13501351 )
13511352 );
1352- functionContributions . getFunctionRegistry () .register (
1353+ functionRegistry .register (
13531354 "offset_datetime" ,
13541355 new CurrentFunction (
13551356 "offset_datetime" ,
13561357 currentTimestampWithTimeZone (),
13571358 offsetDateTimeType
13581359 )
13591360 );
1360- functionContributions . getFunctionRegistry () .registerAlternateKey ( "local date" , "local_date" );
1361- functionContributions . getFunctionRegistry () .registerAlternateKey ( "local time" , "local_time" );
1362- functionContributions . getFunctionRegistry () .registerAlternateKey ( "local datetime" , "local_datetime" );
1363- functionContributions . getFunctionRegistry () .registerAlternateKey ( "offset datetime" , "offset_datetime" );
1361+ functionRegistry .registerAlternateKey ( "local date" , "local_date" );
1362+ functionRegistry .registerAlternateKey ( "local time" , "local_time" );
1363+ functionRegistry .registerAlternateKey ( "local datetime" , "local_datetime" );
1364+ functionRegistry .registerAlternateKey ( "offset datetime" , "offset_datetime" );
13641365
1365- functionContributions . getFunctionRegistry () .register (
1366+ functionRegistry .register (
13661367 "instant" ,
13671368 new CurrentFunction (
13681369 "instant" ,
13691370 currentTimestampWithTimeZone (),
13701371 instantType
13711372 )
13721373 );
1373- functionContributions . getFunctionRegistry () .registerAlternateKey ( "current_instant" , "instant" ); //deprecated legacy!
1374+ functionRegistry .registerAlternateKey ( "current_instant" , "instant" ); //deprecated legacy!
13741375
1375- functionContributions . getFunctionRegistry () .register ( "sql" , new SqlFunction () );
1376+ functionRegistry .register ( "sql" , new SqlFunction () );
13761377 }
13771378
13781379 /**
0 commit comments