Move null check into lambda for DelayedCollectionInitializer

This commit is contained in:
Chris Cranford 2021-03-11 14:58:32 -05:00 committed by Christian Beikov
parent c2569bde4c
commit 79a0c325e9
1 changed files with 10 additions and 6 deletions

View File

@ -76,9 +76,11 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
// LoggingHelper.toLoggableString( getNavigablePath(), this.collectionKey.getKey() )
// );
// }
if ( collectionInstance != null ) {
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) );
}
parentAccess.registerResolutionListener( owner -> {
if ( collectionInstance != null ) {
collectionInstance.setOwner( owner );
}
} );
}
else {
final Object parentKey = parentAccess.getParentKey();
@ -87,9 +89,11 @@ public class DelayedCollectionInitializer extends AbstractCollectionInitializer
collectionAttributeMapping.getCollectionDescriptor(),
parentKey
);
if ( collectionInstance != null ) {
parentAccess.registerResolutionListener( owner -> collectionInstance.setOwner( owner ) );
}
parentAccess.registerResolutionListener( owner -> {
if ( collectionInstance != null ) {
collectionInstance.setOwner( owner );
}
} );
}
}
}