Skip to content

Commit 231163f

Browse files
committed
minor cleanups to CacheEntryHelper
1 parent 983eec0 commit 231163f

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

hibernate-core/src/main/java/org/hibernate/cache/spi/entry/CacheEntryHelper.java

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ public static Serializable[] disassemble(
3333
final boolean[] nonCacheable,
3434
final SharedSessionContractImplementor session,
3535
final Object owner) {
36-
Serializable[] disassembled = new Serializable[types.length];
36+
final Serializable[] disassembled = new Serializable[types.length];
3737
for ( int i = 0; i < row.length; i++ ) {
3838
if ( nonCacheable!=null && nonCacheable[i] ) {
3939
disassembled[i] = LazyPropertyInitializer.UNFETCHED_PROPERTY;
4040
}
41-
else if ( row[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY
42-
| row[i] == PropertyAccessStrategyBackRefImpl.UNKNOWN ) {
41+
else if ( isPlaceholder( row[i] ) ) {
4342
disassembled[i] = (Serializable) row[i];
4443
}
4544
else {
@@ -63,10 +62,9 @@ public static Object[] assemble(
6362
final Type[] types,
6463
final SharedSessionContractImplementor session,
6564
final Object owner) {
66-
Object[] assembled = new Object[row.length];
65+
final Object[] assembled = new Object[row.length];
6766
for ( int i = 0; i < types.length; i++ ) {
68-
if ( row[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY
69-
|| row[i] == PropertyAccessStrategyBackRefImpl.UNKNOWN ) {
67+
if ( isPlaceholder( row[i] ) ) {
7068
assembled[i] = row[i];
7169
}
7270
else {
@@ -76,21 +74,9 @@ public static Object[] assemble(
7674
return assembled;
7775
}
7876

79-
// public static Object[] assemble(
80-
// final Object[] row,
81-
// final Type[] types,
82-
// final SharedSessionContractImplementor session,
83-
// final Object owner) {
84-
// Object[] assembled = new Object[row.length];
85-
// for ( int i = 0; i < types.length; i++ ) {
86-
// if ( row[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY || row[i] == PropertyAccessStrategyBackRefImpl.UNKNOWN ) {
87-
// assembled[i] = row[i];
88-
// }
89-
// else {
90-
// assembled[i] = types[i].assemble( (Serializable) row[i], session, owner );
91-
// }
92-
// }
93-
// return assembled;
94-
// }
77+
private static boolean isPlaceholder(Object value) {
78+
return value == LazyPropertyInitializer.UNFETCHED_PROPERTY
79+
|| value == PropertyAccessStrategyBackRefImpl.UNKNOWN;
80+
}
9581

9682
}

0 commit comments

Comments
 (0)