Skip to content

Commit e5f4b61

Browse files
rvansaSanne
authored andcommitted
HHH-9840 Checkstyle fixes
1 parent cffe71a commit e5f4b61

12 files changed

+36
-32
lines changed

hibernate-core/src/main/java/org/hibernate/cache/internal/OldCacheKeyImplementation.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*
2222
* @author Gavin King
2323
* @author Steve Ebersole
24+
*
25+
* @deprecated In optimized implementations, wrapping the id is not necessary.
2426
*/
2527
@Deprecated
2628
final class OldCacheKeyImplementation implements Serializable {
@@ -55,7 +57,7 @@ final class OldCacheKeyImplementation implements Serializable {
5557
}
5658

5759
private int calculateHashCode(Type type, SessionFactoryImplementor factory) {
58-
int result = type.getHashCode(id, factory );
60+
int result = type.getHashCode( id, factory );
5961
result = 31 * result + (tenantId != null ? tenantId.hashCode() : 0);
6062
return result;
6163
}
@@ -78,7 +80,7 @@ public boolean equals(Object other) {
7880
}
7981
final OldCacheKeyImplementation that = (OldCacheKeyImplementation) other;
8082
return EqualsHelper.equals( entityOrRoleName, that.entityOrRoleName )
81-
&& type.isEqual(id, that.id)
83+
&& type.isEqual( id, that.id)
8284
&& EqualsHelper.equals( tenantId, that.tenantId );
8385
}
8486

hibernate-core/src/main/java/org/hibernate/cache/internal/OldNaturalIdCacheKey.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
*
2828
* @author Eric Dalquist
2929
* @author Steve Ebersole
30+
*
31+
* @deprecated Cache implementation should provide optimized key.
3032
*/
3133
@Deprecated
3234
public class OldNaturalIdCacheKey implements Serializable {

hibernate-core/src/main/java/org/hibernate/cache/spi/access/EntityRegionAccessStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public interface EntityRegionAccessStrategy extends RegionAccessStrategy {
3131

3232
/**
33-
* To create instances of EntityCacheKey for this region, Hibernate will invoke this method
33+
* To create instances of keys for this region, Hibernate will invoke this method
3434
* exclusively so that generated implementations can generate optimised keys.
3535
* @param id the primary identifier of the entity
3636
* @param persister the persister for the type for which a key is being generated

hibernate-core/src/main/java/org/hibernate/engine/loading/internal/CollectionLoadContext.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ private void addCollectionToCache(LoadingCollectionEntry lce, CollectionPersiste
292292
if ( debugEnabled ) {
293293
LOG.debug( "Refusing to add to cache due to enabled filters" );
294294
}
295-
// todo : add the notion of enabled filters to the CacheKey to differentiate filtered collections from non-filtered;
296-
// but CacheKey is currently used for both collections and entities; would ideally need to define two seperate ones;
297-
// currently this works in conjuction with the check on
295+
// todo : add the notion of enabled filters to the cache key to differentiate filtered collections from non-filtered;
298296
// DefaultInitializeCollectionEventHandler.initializeCollectionFromCache() (which makes sure to not read from
299297
// cache with enabled filters).
300298
// EARLY EXIT!!!!!

hibernate-core/src/main/java/org/hibernate/stat/internal/ConcurrentSecondLevelCacheStatisticsImpl.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public class ConcurrentSecondLevelCacheStatisticsImpl extends CategorizedStatist
2929
private AtomicLong putCount = new AtomicLong();
3030

3131
ConcurrentSecondLevelCacheStatisticsImpl(Region region,
32-
EntityRegionAccessStrategy entityRegionAccessStrategy,
33-
CollectionRegionAccessStrategy collectionRegionAccessStrategy) {
32+
EntityRegionAccessStrategy entityRegionAccessStrategy,
33+
CollectionRegionAccessStrategy collectionRegionAccessStrategy) {
3434
super( region.getName() );
3535
this.region = region;
3636
this.entityRegionAccessStrategy = entityRegionAccessStrategy;
@@ -63,34 +63,36 @@ public long getSizeInMemory() {
6363

6464
public Map getEntries() {
6565
Map map = new HashMap();
66-
for (Object o : region.toMap().entrySet()) {
66+
for ( Object o : region.toMap().entrySet() ) {
6767
Map.Entry me = (Map.Entry) o;
6868
Object id;
69-
if (entityRegionAccessStrategy != null) {
70-
id = entityRegionAccessStrategy.getCacheKeyId(me.getKey());
71-
} else if (collectionRegionAccessStrategy != null) {
72-
id = collectionRegionAccessStrategy.getCacheKeyId(me.getKey());
73-
} else {
69+
if ( entityRegionAccessStrategy != null ) {
70+
id = entityRegionAccessStrategy.getCacheKeyId( me.getKey() );
71+
}
72+
else if ( collectionRegionAccessStrategy != null ) {
73+
id = collectionRegionAccessStrategy.getCacheKeyId( me.getKey() );
74+
}
75+
else {
7476
id = me.getKey();
7577
}
76-
map.put(id, me.getValue());
78+
map.put( id, me.getValue() );
7779
}
7880
return map;
7981
}
8082

8183
public String toString() {
8284
StringBuilder buf = new StringBuilder()
83-
.append("SecondLevelCacheStatistics")
84-
.append("[hitCount=").append(this.hitCount)
85-
.append(",missCount=").append(this.missCount)
86-
.append(",putCount=").append(this.putCount);
85+
.append( "SecondLevelCacheStatistics" )
86+
.append( "[hitCount=").append( this.hitCount )
87+
.append( ",missCount=").append( this.missCount )
88+
.append( ",putCount=").append( this.putCount );
8789
//not sure if this would ever be null but wanted to be careful
88-
if (region != null) {
89-
buf.append(",elementCountInMemory=").append(this.getElementCountInMemory())
90-
.append(",elementCountOnDisk=").append(this.getElementCountOnDisk())
91-
.append(",sizeInMemory=").append(this.getSizeInMemory());
90+
if ( region != null ) {
91+
buf.append( ",elementCountInMemory=" ).append( this.getElementCountInMemory() )
92+
.append( ",elementCountOnDisk=" ).append( this.getElementCountOnDisk() )
93+
.append( ",sizeInMemory=" ).append( this.getSizeInMemory() );
9294
}
93-
buf.append(']');
95+
buf.append( ']' );
9496
return buf.toString();
9597
}
9698

hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/internal/strategy/NonStrictReadWriteEhcacheCollectionRegionAccessStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ public Object generateCacheKey(Object id, CollectionPersister persister, Session
9090

9191
@Override
9292
public Object getCacheKeyId(Object cacheKey) {
93-
return DefaultCacheKeysFactory.getCollectionId(cacheKey);
93+
return DefaultCacheKeysFactory.getCollectionId( cacheKey );
9494
}
9595
}

hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/internal/strategy/NonStrictReadWriteEhcacheEntityRegionAccessStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ public Object generateCacheKey(Object id, EntityPersister persister, SessionFact
129129

130130
@Override
131131
public Object getCacheKeyId(Object cacheKey) {
132-
return DefaultCacheKeysFactory.getEntityId(cacheKey);
132+
return DefaultCacheKeysFactory.getEntityId( cacheKey );
133133
}
134134
}

hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/internal/strategy/NonStrictReadWriteEhcacheNaturalIdRegionAccessStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ public void remove(Object key) throws CacheException {
120120
region().remove( key );
121121
}
122122

123-
@Override
123+
@Override
124124
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SessionImplementor session) {
125125
return DefaultCacheKeysFactory.createNaturalIdKey(naturalIdValues, persister, session);
126126
}
127127

128128
@Override
129129
public Object[] getNaturalIdValues(Object cacheKey) {
130-
return DefaultCacheKeysFactory.getNaturalIdValues(cacheKey);
130+
return DefaultCacheKeysFactory.getNaturalIdValues( cacheKey );
131131
}
132132
}

hibernate-testing/src/main/java/org/hibernate/testing/cache/BaseNaturalIdRegionAccessStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persist
6666

6767
@Override
6868
public Object[] getNaturalIdValues(Object cacheKey) {
69-
return DefaultCacheKeysFactory.getNaturalIdValues(cacheKey);
69+
return DefaultCacheKeysFactory.getNaturalIdValues( cacheKey );
7070
}
7171
}

hibernate-testing/src/main/java/org/hibernate/testing/cache/ReadWriteCollectionRegionAccessStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public Object generateCacheKey(Object id, CollectionPersister persister, Session
5353

5454
@Override
5555
public Object getCacheKeyId(Object cacheKey) {
56-
return DefaultCacheKeysFactory.getCollectionId(cacheKey);
56+
return DefaultCacheKeysFactory.getCollectionId( cacheKey );
5757
}
5858
}

0 commit comments

Comments
 (0)