very minor code cleanups

This commit is contained in:
Gavin King 2022-09-24 15:31:05 +02:00
parent 39ae0bf264
commit bb996705b7
3 changed files with 10 additions and 23 deletions

View File

@ -1819,13 +1819,9 @@ public class StatefulPersistenceContext implements PersistenceContext {
@Override
public boolean containsNullifiableEntityKey(Supplier<EntityKey> sek) {
if ( nullifiableEntityKeys == null || nullifiableEntityKeys.size() == 0 ) {
return false;
}
else {
final EntityKey entityKey = sek.get();
return nullifiableEntityKeys.contains( entityKey );
}
return nullifiableEntityKeys != null
&& nullifiableEntityKeys.size() != 0
&& nullifiableEntityKeys.contains( sek.get() );
}
@Override
@ -1838,7 +1834,8 @@ public class StatefulPersistenceContext implements PersistenceContext {
@Override
public boolean isNullifiableEntityKeysEmpty() {
return ( nullifiableEntityKeys == null || nullifiableEntityKeys.size() == 0 );
return nullifiableEntityKeys == null
|| nullifiableEntityKeys.size() == 0;
}
@Override
@ -1848,12 +1845,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
@Override
public CollectionEntry removeCollectionEntry(PersistentCollection<?> collection) {
if ( collectionEntries == null ) {
return null;
}
else {
return collectionEntries.remove( collection );
}
return collectionEntries == null ? null : collectionEntries.remove(collection);
}
@Override

View File

@ -102,12 +102,8 @@ public final class EntityKey implements Serializable {
}
private boolean samePersistentType(final EntityKey otherKey) {
if ( otherKey.persister == persister ) {
return true;
}
else {
return Objects.equals( otherKey.persister.getRootEntityName(), persister.getRootEntityName() );
}
return otherKey.persister == persister
|| Objects.equals( otherKey.persister.getRootEntityName(), persister.getRootEntityName() );
}
@Override
@ -117,8 +113,7 @@ public final class EntityKey implements Serializable {
@Override
public String toString() {
return "EntityKey" +
MessageHelper.infoString( this.persister, identifier, persister.getFactory() );
return "EntityKey" + MessageHelper.infoString( this.persister, identifier, persister.getFactory() );
}
/**

View File

@ -319,7 +319,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
@Override
public final Object getImplementation(SharedSessionContractImplementor s) throws HibernateException {
final EntityKey entityKey = generateEntityKeyOrNull( getInternalIdentifier(), s, getEntityName() );
return ( entityKey == null ? null : s.getPersistenceContext().getEntity( entityKey ) );
return entityKey == null ? null : s.getPersistenceContext().getEntity( entityKey );
}
/**