@@ -542,14 +542,13 @@ public Class<? extends UserType<?>> findRegisteredUserType(Class<?> basicType) {
542
542
543
543
@ Override
544
544
public void addCollectionTypeRegistration (CollectionTypeRegistration registrationAnnotation ) {
545
- addCollectionTypeRegistration (
546
- registrationAnnotation .classification (),
547
- toDescriptor ( registrationAnnotation )
548
- );
545
+ addCollectionTypeRegistration ( registrationAnnotation .classification (),
546
+ toDescriptor ( registrationAnnotation ) );
549
547
}
550
548
551
549
@ Override
552
- public void addCollectionTypeRegistration (CollectionClassification classification , CollectionTypeRegistrationDescriptor descriptor ) {
550
+ public void addCollectionTypeRegistration (
551
+ CollectionClassification classification , CollectionTypeRegistrationDescriptor descriptor ) {
553
552
if ( collectionTypeRegistrations == null ) {
554
553
collectionTypeRegistrations = new HashMap <>();
555
554
}
@@ -558,18 +557,13 @@ public void addCollectionTypeRegistration(CollectionClassification classificatio
558
557
559
558
@ Override
560
559
public CollectionTypeRegistrationDescriptor findCollectionTypeRegistration (CollectionClassification classification ) {
561
- if ( collectionTypeRegistrations == null ) {
562
- return null ;
563
- }
560
+ return collectionTypeRegistrations == null ? null : collectionTypeRegistrations .get ( classification );
564
561
565
- return collectionTypeRegistrations .get ( classification );
566
562
}
567
563
568
564
private CollectionTypeRegistrationDescriptor toDescriptor (CollectionTypeRegistration registrationAnnotation ) {
569
- return new CollectionTypeRegistrationDescriptor (
570
- registrationAnnotation .type (),
571
- extractParameters ( registrationAnnotation .parameters () )
572
- );
565
+ return new CollectionTypeRegistrationDescriptor ( registrationAnnotation .type (),
566
+ extractParameters ( registrationAnnotation .parameters () ) );
573
567
}
574
568
575
569
private Map <String ,String > extractParameters (Parameter [] annotationUsages ) {
@@ -675,7 +669,7 @@ public void addFetchProfile(FetchProfile profile) {
675
669
if ( profile == null || profile .getName () == null ) {
676
670
throw new IllegalArgumentException ( "Fetch profile object or name is null: " + profile );
677
671
}
678
- FetchProfile old = fetchProfileMap .put ( profile .getName (), profile );
672
+ final FetchProfile old = fetchProfileMap .put ( profile .getName (), profile );
679
673
if ( old != null ) {
680
674
log .warn ( "Duplicated fetch profile with same name [" + profile .getName () + "] found." );
681
675
}
@@ -966,16 +960,11 @@ public Table addTable(
966
960
967
961
// annotation binding depends on the "table name" for @Subselect bindings
968
962
// being set into the generated table (mainly to avoid later NPE), but for now we need to keep that :(
969
- final Identifier logicalName ;
970
- if ( name != null ) {
971
- logicalName = getDatabase ().toIdentifier ( name );
972
- }
973
- else {
974
- logicalName = null ;
975
- }
963
+ final Identifier logicalName = name != null ? getDatabase ().toIdentifier ( name ) : null ;
976
964
977
965
if ( subselectFragment != null ) {
978
- return new Table ( buildingContext .getCurrentContributorName (), namespace , logicalName , subselectFragment , isAbstract );
966
+ return new Table ( buildingContext .getCurrentContributorName (),
967
+ namespace , logicalName , subselectFragment , isAbstract );
979
968
}
980
969
else {
981
970
final Table existing = namespace .locateTable ( logicalName );
@@ -988,7 +977,9 @@ public Table addTable(
988
977
989
978
return namespace .createTable (
990
979
logicalName ,
991
- (physicalName ) -> new Table ( buildingContext .getCurrentContributorName (), namespace , physicalName , isAbstract )
980
+ (physicalName ) ->
981
+ new Table ( buildingContext .getCurrentContributorName (),
982
+ namespace , physicalName , isAbstract )
992
983
);
993
984
}
994
985
}
@@ -1379,14 +1370,8 @@ public void addPropertyAnnotatedWithMapsId(ClassDetails entityType, PropertyData
1379
1370
propertiesAnnotatedWithMapsId = new HashMap <>();
1380
1371
}
1381
1372
1382
- final Map <String , PropertyData > map = propertiesAnnotatedWithMapsId .computeIfAbsent (
1383
- entityType ,
1384
- k -> new HashMap <>()
1385
- );
1386
- map .put (
1387
- property .getAttributeMember ().getDirectAnnotationUsage ( MapsId .class ).value (),
1388
- property
1389
- );
1373
+ propertiesAnnotatedWithMapsId .computeIfAbsent ( entityType , k -> new HashMap <>() )
1374
+ .put ( property .getAttributeMember ().getDirectAnnotationUsage ( MapsId .class ).value (), property );
1390
1375
}
1391
1376
1392
1377
@ Override
@@ -1395,11 +1380,8 @@ public void addPropertyAnnotatedWithMapsIdSpecj(ClassDetails entityType, Propert
1395
1380
propertiesAnnotatedWithMapsId = new HashMap <>();
1396
1381
}
1397
1382
1398
- final Map <String , PropertyData > map = propertiesAnnotatedWithMapsId .computeIfAbsent (
1399
- entityType ,
1400
- k -> new HashMap <>()
1401
- );
1402
- map .put ( mapsIdValue , property );
1383
+ propertiesAnnotatedWithMapsId .computeIfAbsent ( entityType , k -> new HashMap <>() )
1384
+ .put ( mapsIdValue , property );
1403
1385
}
1404
1386
1405
1387
@ Override
@@ -1418,9 +1400,8 @@ public void addToOneAndIdProperty(ClassDetails entityType, PropertyData property
1418
1400
propertiesAnnotatedWithIdAndToOne = new HashMap <>();
1419
1401
}
1420
1402
1421
- final Map <String , PropertyData > map =
1422
- propertiesAnnotatedWithIdAndToOne .computeIfAbsent ( entityType , k -> new HashMap <>() );
1423
- map .put ( property .getPropertyName (), property );
1403
+ propertiesAnnotatedWithIdAndToOne .computeIfAbsent ( entityType , k -> new HashMap <>() )
1404
+ .put ( property .getPropertyName (), property );
1424
1405
}
1425
1406
1426
1407
@ Override
@@ -1433,10 +1414,7 @@ public void addMappedBy(String entityName, String propertyName, String inversePr
1433
1414
1434
1415
@ Override
1435
1416
public String getFromMappedBy (String entityName , String propertyName ) {
1436
- if ( mappedByResolver == null ) {
1437
- return null ;
1438
- }
1439
- return mappedByResolver .get ( entityName + "." + propertyName );
1417
+ return mappedByResolver == null ? null : mappedByResolver .get ( entityName + "." + propertyName );
1440
1418
}
1441
1419
1442
1420
@ Override
@@ -1449,10 +1427,7 @@ public void addPropertyReferencedAssociation(String entityName, String propertyN
1449
1427
1450
1428
@ Override
1451
1429
public String getPropertyReferencedAssociation (String entityName , String propertyName ) {
1452
- if ( propertyRefResolver == null ) {
1453
- return null ;
1454
- }
1455
- return propertyRefResolver .get ( entityName + "." + propertyName );
1430
+ return propertyRefResolver == null ? null : propertyRefResolver .get ( entityName + "." + propertyName );
1456
1431
}
1457
1432
1458
1433
private static class DelayedPropertyReferenceHandlerAnnotationImpl implements DelayedPropertyReferenceHandler {
@@ -1528,7 +1503,7 @@ public EntityTableXref addEntityTableXref(
1528
1503
1529
1504
@ Override
1530
1505
public Map <String , Join > getJoins (String entityName ) {
1531
- EntityTableXrefImpl xrefEntry = entityTableXrefMap .get ( entityName );
1506
+ final EntityTableXrefImpl xrefEntry = entityTableXrefMap .get ( entityName );
1532
1507
return xrefEntry == null ? null : xrefEntry .secondaryTableJoinMap ;
1533
1508
}
1534
1509
@@ -1541,14 +1516,16 @@ private static final class EntityTableXrefImpl implements EntityTableXref {
1541
1516
//private Map<Identifier,Join> secondaryTableJoinMap;
1542
1517
private Map <String ,Join > secondaryTableJoinMap ;
1543
1518
1544
- public EntityTableXrefImpl (Identifier primaryTableLogicalName , Table primaryTable , EntityTableXrefImpl superEntityTableXref ) {
1519
+ public EntityTableXrefImpl (
1520
+ Identifier primaryTableLogicalName , Table primaryTable , EntityTableXrefImpl superEntityTableXref ) {
1545
1521
this .primaryTableLogicalName = primaryTableLogicalName ;
1546
1522
this .primaryTable = primaryTable ;
1547
1523
this .superEntityTableXref = superEntityTableXref ;
1548
1524
}
1549
1525
1550
1526
@ Override
1551
- public void addSecondaryTable (LocalMetadataBuildingContext buildingContext , Identifier logicalName , Join secondaryTableJoin ) {
1527
+ public void addSecondaryTable (
1528
+ LocalMetadataBuildingContext buildingContext , Identifier logicalName , Join secondaryTableJoin ) {
1552
1529
if ( Identifier .areEqual ( primaryTableLogicalName , logicalName ) ) {
1553
1530
throw new org .hibernate .boot .MappingException (
1554
1531
String .format (
@@ -1586,6 +1563,8 @@ public void addSecondaryTable(LocalMetadataBuildingContext buildingContext, Iden
1586
1563
1587
1564
@ Override
1588
1565
public void addSecondaryTable (QualifiedTableName logicalQualifiedTableName , Join secondaryTableJoin ) {
1566
+ final Identifier tableName = logicalQualifiedTableName .getTableName ();
1567
+
1589
1568
if ( Identifier .areEqual (
1590
1569
toIdentifier (
1591
1570
new QualifiedTableName (
@@ -1595,21 +1574,21 @@ public void addSecondaryTable(QualifiedTableName logicalQualifiedTableName, Join
1595
1574
).render ()
1596
1575
),
1597
1576
toIdentifier ( logicalQualifiedTableName .render () ) ) ) {
1598
- throw new DuplicateSecondaryTableException ( logicalQualifiedTableName . getTableName () );
1577
+ throw new DuplicateSecondaryTableException ( tableName );
1599
1578
}
1600
1579
1601
1580
if ( secondaryTableJoinMap == null ) {
1602
1581
//secondaryTableJoinMap = new HashMap<Identifier,Join>();
1603
1582
//secondaryTableJoinMap.put( logicalName, secondaryTableJoin );
1604
1583
secondaryTableJoinMap = new HashMap <>();
1605
- secondaryTableJoinMap .put ( logicalQualifiedTableName . getTableName () .getCanonicalName (), secondaryTableJoin );
1584
+ secondaryTableJoinMap .put ( tableName .getCanonicalName (), secondaryTableJoin );
1606
1585
}
1607
1586
else {
1608
1587
//final Join existing = secondaryTableJoinMap.put( logicalName, secondaryTableJoin );
1609
- final Join existing = secondaryTableJoinMap . put ( logicalQualifiedTableName . getTableName (). getCanonicalName (), secondaryTableJoin );
1610
-
1588
+ final Join existing =
1589
+ secondaryTableJoinMap . put ( tableName . getCanonicalName (), secondaryTableJoin );
1611
1590
if ( existing != null ) {
1612
- throw new DuplicateSecondaryTableException ( logicalQualifiedTableName . getTableName () );
1591
+ throw new DuplicateSecondaryTableException ( tableName );
1613
1592
}
1614
1593
}
1615
1594
}
@@ -1689,41 +1668,38 @@ public void addSecondPass(SecondPass secondPass) {
1689
1668
1690
1669
@ Override
1691
1670
public void addSecondPass (SecondPass secondPass , boolean onTopOfTheQueue ) {
1692
- if ( secondPass instanceof IdGeneratorResolver ) {
1693
- addIdGeneratorResolverSecondPass ( ( IdGeneratorResolver ) secondPass , onTopOfTheQueue );
1671
+ if ( secondPass instanceof IdGeneratorResolver generatorResolver ) {
1672
+ addIdGeneratorResolverSecondPass ( generatorResolver , onTopOfTheQueue );
1694
1673
}
1695
- else if ( secondPass instanceof SetBasicValueTypeSecondPass ) {
1696
- addSetBasicValueTypeSecondPass ( ( SetBasicValueTypeSecondPass ) secondPass , onTopOfTheQueue );
1674
+ else if ( secondPass instanceof SetBasicValueTypeSecondPass setBasicValueTypeSecondPass ) {
1675
+ addSetBasicValueTypeSecondPass ( setBasicValueTypeSecondPass , onTopOfTheQueue );
1697
1676
}
1698
- else if ( secondPass instanceof AggregateComponentSecondPass ) {
1699
- addAggregateComponentSecondPass ( ( AggregateComponentSecondPass ) secondPass , onTopOfTheQueue );
1677
+ else if ( secondPass instanceof AggregateComponentSecondPass aggregateComponentSecondPass ) {
1678
+ addAggregateComponentSecondPass ( aggregateComponentSecondPass , onTopOfTheQueue );
1700
1679
}
1701
- else if ( secondPass instanceof FkSecondPass ) {
1702
- addFkSecondPass ( ( FkSecondPass ) secondPass , onTopOfTheQueue );
1680
+ else if ( secondPass instanceof FkSecondPass fkSecondPass ) {
1681
+ addFkSecondPass ( fkSecondPass , onTopOfTheQueue );
1703
1682
}
1704
- else if ( secondPass instanceof CreateKeySecondPass ) {
1705
- addCreateKeySecondPass ( ( CreateKeySecondPass ) secondPass , onTopOfTheQueue );
1683
+ else if ( secondPass instanceof CreateKeySecondPass createKeySecondPass ) {
1684
+ addCreateKeySecondPass ( createKeySecondPass , onTopOfTheQueue );
1706
1685
}
1707
- else if ( secondPass instanceof ImplicitToOneJoinTableSecondPass ) {
1708
- addImplicitToOneJoinTableSecondPass ( ( ImplicitToOneJoinTableSecondPass ) secondPass );
1686
+ else if ( secondPass instanceof ImplicitToOneJoinTableSecondPass implicitToOneJoinTableSecondPass ) {
1687
+ addImplicitToOneJoinTableSecondPass ( implicitToOneJoinTableSecondPass );
1709
1688
}
1710
- else if ( secondPass instanceof SecondaryTableSecondPass ) {
1711
- addSecondaryTableSecondPass ( ( SecondaryTableSecondPass ) secondPass , onTopOfTheQueue );
1689
+ else if ( secondPass instanceof SecondaryTableSecondPass secondaryTableSecondPass ) {
1690
+ addSecondaryTableSecondPass ( secondaryTableSecondPass , onTopOfTheQueue );
1712
1691
}
1713
- else if ( secondPass instanceof SecondaryTableFromAnnotationSecondPass ) {
1714
- addSecondaryTableFromAnnotationSecondPass (
1715
- (SecondaryTableFromAnnotationSecondPass ) secondPass ,
1716
- onTopOfTheQueue
1717
- );
1692
+ else if ( secondPass instanceof SecondaryTableFromAnnotationSecondPass secondaryTableFromAnnotationSecondPass ) {
1693
+ addSecondaryTableFromAnnotationSecondPass ( secondaryTableFromAnnotationSecondPass , onTopOfTheQueue );
1718
1694
}
1719
- else if ( secondPass instanceof QuerySecondPass ) {
1720
- addQuerySecondPass ( ( QuerySecondPass ) secondPass , onTopOfTheQueue );
1695
+ else if ( secondPass instanceof QuerySecondPass querySecondPass ) {
1696
+ addQuerySecondPass ( querySecondPass , onTopOfTheQueue );
1721
1697
}
1722
- else if ( secondPass instanceof ImplicitColumnNamingSecondPass ) {
1723
- addImplicitColumnNamingSecondPass ( ( ImplicitColumnNamingSecondPass ) secondPass );
1698
+ else if ( secondPass instanceof ImplicitColumnNamingSecondPass implicitColumnNamingSecondPass ) {
1699
+ addImplicitColumnNamingSecondPass ( implicitColumnNamingSecondPass );
1724
1700
}
1725
- else if ( secondPass instanceof OptionalDeterminationSecondPass ) {
1726
- addOptionalDeterminationSecondPass ( ( OptionalDeterminationSecondPass ) secondPass );
1701
+ else if ( secondPass instanceof OptionalDeterminationSecondPass optionalDeterminationSecondPass ) {
1702
+ addOptionalDeterminationSecondPass ( optionalDeterminationSecondPass );
1727
1703
}
1728
1704
else {
1729
1705
// add to the general SecondPass list
@@ -1792,7 +1768,8 @@ private void addSecondaryTableSecondPass(SecondaryTableSecondPass secondPass, bo
1792
1768
addSecondPass ( secondPass , secondaryTableSecondPassList , onTopOfTheQueue );
1793
1769
}
1794
1770
1795
- private void addSecondaryTableFromAnnotationSecondPass (SecondaryTableFromAnnotationSecondPass secondPass , boolean onTopOfTheQueue ){
1771
+ private void addSecondaryTableFromAnnotationSecondPass (
1772
+ SecondaryTableFromAnnotationSecondPass secondPass , boolean onTopOfTheQueue ){
1796
1773
if ( secondaryTableFromAnnotationSecondPassesList == null ) {
1797
1774
secondaryTableFromAnnotationSecondPassesList = new ArrayList <>();
1798
1775
}
0 commit comments