@@ -542,14 +542,13 @@ public Class<? extends UserType<?>> findRegisteredUserType(Class<?> basicType) {
542542
543543 @ Override
544544 public void addCollectionTypeRegistration (CollectionTypeRegistration registrationAnnotation ) {
545- addCollectionTypeRegistration (
546- registrationAnnotation .classification (),
547- toDescriptor ( registrationAnnotation )
548- );
545+ addCollectionTypeRegistration ( registrationAnnotation .classification (),
546+ toDescriptor ( registrationAnnotation ) );
549547 }
550548
551549 @ Override
552- public void addCollectionTypeRegistration (CollectionClassification classification , CollectionTypeRegistrationDescriptor descriptor ) {
550+ public void addCollectionTypeRegistration (
551+ CollectionClassification classification , CollectionTypeRegistrationDescriptor descriptor ) {
553552 if ( collectionTypeRegistrations == null ) {
554553 collectionTypeRegistrations = new HashMap <>();
555554 }
@@ -558,18 +557,13 @@ public void addCollectionTypeRegistration(CollectionClassification classificatio
558557
559558 @ Override
560559 public CollectionTypeRegistrationDescriptor findCollectionTypeRegistration (CollectionClassification classification ) {
561- if ( collectionTypeRegistrations == null ) {
562- return null ;
563- }
560+ return collectionTypeRegistrations == null ? null : collectionTypeRegistrations .get ( classification );
564561
565- return collectionTypeRegistrations .get ( classification );
566562 }
567563
568564 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 () ) );
573567 }
574568
575569 private Map <String ,String > extractParameters (Parameter [] annotationUsages ) {
@@ -675,7 +669,7 @@ public void addFetchProfile(FetchProfile profile) {
675669 if ( profile == null || profile .getName () == null ) {
676670 throw new IllegalArgumentException ( "Fetch profile object or name is null: " + profile );
677671 }
678- FetchProfile old = fetchProfileMap .put ( profile .getName (), profile );
672+ final FetchProfile old = fetchProfileMap .put ( profile .getName (), profile );
679673 if ( old != null ) {
680674 log .warn ( "Duplicated fetch profile with same name [" + profile .getName () + "] found." );
681675 }
@@ -966,16 +960,11 @@ public Table addTable(
966960
967961 // annotation binding depends on the "table name" for @Subselect bindings
968962 // 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 ;
976964
977965 if ( subselectFragment != null ) {
978- return new Table ( buildingContext .getCurrentContributorName (), namespace , logicalName , subselectFragment , isAbstract );
966+ return new Table ( buildingContext .getCurrentContributorName (),
967+ namespace , logicalName , subselectFragment , isAbstract );
979968 }
980969 else {
981970 final Table existing = namespace .locateTable ( logicalName );
@@ -988,7 +977,9 @@ public Table addTable(
988977
989978 return namespace .createTable (
990979 logicalName ,
991- (physicalName ) -> new Table ( buildingContext .getCurrentContributorName (), namespace , physicalName , isAbstract )
980+ (physicalName ) ->
981+ new Table ( buildingContext .getCurrentContributorName (),
982+ namespace , physicalName , isAbstract )
992983 );
993984 }
994985 }
@@ -1379,14 +1370,8 @@ public void addPropertyAnnotatedWithMapsId(ClassDetails entityType, PropertyData
13791370 propertiesAnnotatedWithMapsId = new HashMap <>();
13801371 }
13811372
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 );
13901375 }
13911376
13921377 @ Override
@@ -1395,11 +1380,8 @@ public void addPropertyAnnotatedWithMapsIdSpecj(ClassDetails entityType, Propert
13951380 propertiesAnnotatedWithMapsId = new HashMap <>();
13961381 }
13971382
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 );
14031385 }
14041386
14051387 @ Override
@@ -1418,9 +1400,8 @@ public void addToOneAndIdProperty(ClassDetails entityType, PropertyData property
14181400 propertiesAnnotatedWithIdAndToOne = new HashMap <>();
14191401 }
14201402
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 );
14241405 }
14251406
14261407 @ Override
@@ -1433,10 +1414,7 @@ public void addMappedBy(String entityName, String propertyName, String inversePr
14331414
14341415 @ Override
14351416 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 );
14401418 }
14411419
14421420 @ Override
@@ -1449,10 +1427,7 @@ public void addPropertyReferencedAssociation(String entityName, String propertyN
14491427
14501428 @ Override
14511429 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 );
14561431 }
14571432
14581433 private static class DelayedPropertyReferenceHandlerAnnotationImpl implements DelayedPropertyReferenceHandler {
@@ -1528,7 +1503,7 @@ public EntityTableXref addEntityTableXref(
15281503
15291504 @ Override
15301505 public Map <String , Join > getJoins (String entityName ) {
1531- EntityTableXrefImpl xrefEntry = entityTableXrefMap .get ( entityName );
1506+ final EntityTableXrefImpl xrefEntry = entityTableXrefMap .get ( entityName );
15321507 return xrefEntry == null ? null : xrefEntry .secondaryTableJoinMap ;
15331508 }
15341509
@@ -1541,14 +1516,16 @@ private static final class EntityTableXrefImpl implements EntityTableXref {
15411516 //private Map<Identifier,Join> secondaryTableJoinMap;
15421517 private Map <String ,Join > secondaryTableJoinMap ;
15431518
1544- public EntityTableXrefImpl (Identifier primaryTableLogicalName , Table primaryTable , EntityTableXrefImpl superEntityTableXref ) {
1519+ public EntityTableXrefImpl (
1520+ Identifier primaryTableLogicalName , Table primaryTable , EntityTableXrefImpl superEntityTableXref ) {
15451521 this .primaryTableLogicalName = primaryTableLogicalName ;
15461522 this .primaryTable = primaryTable ;
15471523 this .superEntityTableXref = superEntityTableXref ;
15481524 }
15491525
15501526 @ Override
1551- public void addSecondaryTable (LocalMetadataBuildingContext buildingContext , Identifier logicalName , Join secondaryTableJoin ) {
1527+ public void addSecondaryTable (
1528+ LocalMetadataBuildingContext buildingContext , Identifier logicalName , Join secondaryTableJoin ) {
15521529 if ( Identifier .areEqual ( primaryTableLogicalName , logicalName ) ) {
15531530 throw new org .hibernate .boot .MappingException (
15541531 String .format (
@@ -1586,6 +1563,8 @@ public void addSecondaryTable(LocalMetadataBuildingContext buildingContext, Iden
15861563
15871564 @ Override
15881565 public void addSecondaryTable (QualifiedTableName logicalQualifiedTableName , Join secondaryTableJoin ) {
1566+ final Identifier tableName = logicalQualifiedTableName .getTableName ();
1567+
15891568 if ( Identifier .areEqual (
15901569 toIdentifier (
15911570 new QualifiedTableName (
@@ -1595,21 +1574,21 @@ public void addSecondaryTable(QualifiedTableName logicalQualifiedTableName, Join
15951574 ).render ()
15961575 ),
15971576 toIdentifier ( logicalQualifiedTableName .render () ) ) ) {
1598- throw new DuplicateSecondaryTableException ( logicalQualifiedTableName . getTableName () );
1577+ throw new DuplicateSecondaryTableException ( tableName );
15991578 }
16001579
16011580 if ( secondaryTableJoinMap == null ) {
16021581 //secondaryTableJoinMap = new HashMap<Identifier,Join>();
16031582 //secondaryTableJoinMap.put( logicalName, secondaryTableJoin );
16041583 secondaryTableJoinMap = new HashMap <>();
1605- secondaryTableJoinMap .put ( logicalQualifiedTableName . getTableName () .getCanonicalName (), secondaryTableJoin );
1584+ secondaryTableJoinMap .put ( tableName .getCanonicalName (), secondaryTableJoin );
16061585 }
16071586 else {
16081587 //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 );
16111590 if ( existing != null ) {
1612- throw new DuplicateSecondaryTableException ( logicalQualifiedTableName . getTableName () );
1591+ throw new DuplicateSecondaryTableException ( tableName );
16131592 }
16141593 }
16151594 }
@@ -1689,41 +1668,38 @@ public void addSecondPass(SecondPass secondPass) {
16891668
16901669 @ Override
16911670 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 );
16941673 }
1695- else if ( secondPass instanceof SetBasicValueTypeSecondPass ) {
1696- addSetBasicValueTypeSecondPass ( ( SetBasicValueTypeSecondPass ) secondPass , onTopOfTheQueue );
1674+ else if ( secondPass instanceof SetBasicValueTypeSecondPass setBasicValueTypeSecondPass ) {
1675+ addSetBasicValueTypeSecondPass ( setBasicValueTypeSecondPass , onTopOfTheQueue );
16971676 }
1698- else if ( secondPass instanceof AggregateComponentSecondPass ) {
1699- addAggregateComponentSecondPass ( ( AggregateComponentSecondPass ) secondPass , onTopOfTheQueue );
1677+ else if ( secondPass instanceof AggregateComponentSecondPass aggregateComponentSecondPass ) {
1678+ addAggregateComponentSecondPass ( aggregateComponentSecondPass , onTopOfTheQueue );
17001679 }
1701- else if ( secondPass instanceof FkSecondPass ) {
1702- addFkSecondPass ( ( FkSecondPass ) secondPass , onTopOfTheQueue );
1680+ else if ( secondPass instanceof FkSecondPass fkSecondPass ) {
1681+ addFkSecondPass ( fkSecondPass , onTopOfTheQueue );
17031682 }
1704- else if ( secondPass instanceof CreateKeySecondPass ) {
1705- addCreateKeySecondPass ( ( CreateKeySecondPass ) secondPass , onTopOfTheQueue );
1683+ else if ( secondPass instanceof CreateKeySecondPass createKeySecondPass ) {
1684+ addCreateKeySecondPass ( createKeySecondPass , onTopOfTheQueue );
17061685 }
1707- else if ( secondPass instanceof ImplicitToOneJoinTableSecondPass ) {
1708- addImplicitToOneJoinTableSecondPass ( ( ImplicitToOneJoinTableSecondPass ) secondPass );
1686+ else if ( secondPass instanceof ImplicitToOneJoinTableSecondPass implicitToOneJoinTableSecondPass ) {
1687+ addImplicitToOneJoinTableSecondPass ( implicitToOneJoinTableSecondPass );
17091688 }
1710- else if ( secondPass instanceof SecondaryTableSecondPass ) {
1711- addSecondaryTableSecondPass ( ( SecondaryTableSecondPass ) secondPass , onTopOfTheQueue );
1689+ else if ( secondPass instanceof SecondaryTableSecondPass secondaryTableSecondPass ) {
1690+ addSecondaryTableSecondPass ( secondaryTableSecondPass , onTopOfTheQueue );
17121691 }
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 );
17181694 }
1719- else if ( secondPass instanceof QuerySecondPass ) {
1720- addQuerySecondPass ( ( QuerySecondPass ) secondPass , onTopOfTheQueue );
1695+ else if ( secondPass instanceof QuerySecondPass querySecondPass ) {
1696+ addQuerySecondPass ( querySecondPass , onTopOfTheQueue );
17211697 }
1722- else if ( secondPass instanceof ImplicitColumnNamingSecondPass ) {
1723- addImplicitColumnNamingSecondPass ( ( ImplicitColumnNamingSecondPass ) secondPass );
1698+ else if ( secondPass instanceof ImplicitColumnNamingSecondPass implicitColumnNamingSecondPass ) {
1699+ addImplicitColumnNamingSecondPass ( implicitColumnNamingSecondPass );
17241700 }
1725- else if ( secondPass instanceof OptionalDeterminationSecondPass ) {
1726- addOptionalDeterminationSecondPass ( ( OptionalDeterminationSecondPass ) secondPass );
1701+ else if ( secondPass instanceof OptionalDeterminationSecondPass optionalDeterminationSecondPass ) {
1702+ addOptionalDeterminationSecondPass ( optionalDeterminationSecondPass );
17271703 }
17281704 else {
17291705 // add to the general SecondPass list
@@ -1792,7 +1768,8 @@ private void addSecondaryTableSecondPass(SecondaryTableSecondPass secondPass, bo
17921768 addSecondPass ( secondPass , secondaryTableSecondPassList , onTopOfTheQueue );
17931769 }
17941770
1795- private void addSecondaryTableFromAnnotationSecondPass (SecondaryTableFromAnnotationSecondPass secondPass , boolean onTopOfTheQueue ){
1771+ private void addSecondaryTableFromAnnotationSecondPass (
1772+ SecondaryTableFromAnnotationSecondPass secondPass , boolean onTopOfTheQueue ){
17961773 if ( secondaryTableFromAnnotationSecondPassesList == null ) {
17971774 secondaryTableFromAnnotationSecondPassesList = new ArrayList <>();
17981775 }
0 commit comments