@@ -174,59 +174,59 @@ public void afterSingletonsInstantiated() {
174
174
175
175
@ Override
176
176
protected void onInit () {
177
- List <CacheOperation > cacheOperations ;
177
+ List <CacheOperation > cacheOperationsToUse ;
178
178
if (!ObjectUtils .isEmpty (this .cacheNames )) {
179
- cacheOperations = this . cacheOperations . stream ()
180
- . filter (( operation ) -> ObjectUtils . isEmpty ( operation . getCacheNames ()) )
181
- . map ((operation ) -> {
182
- CacheOperation . Builder builder ;
183
- if ( operation instanceof CacheableOperation ) {
184
- CacheableOperation cacheableOperation = ( CacheableOperation ) operation ;
185
- CacheableOperation . Builder cacheableBuilder = new CacheableOperation . Builder () ;
186
- cacheableBuilder . setSync ( cacheableOperation . isSync () );
187
- String unless = cacheableOperation .getUnless ( );
188
- if ( unless != null ) {
189
- cacheableBuilder . setUnless (unless );
190
- }
191
- builder = cacheableBuilder ;
192
- }
193
- else if ( operation instanceof CacheEvictOperation ) {
194
- CacheEvictOperation . Builder cacheEvictBuilder = new CacheEvictOperation . Builder ();
195
- CacheEvictOperation cacheEvictOperation = ( CacheEvictOperation ) operation ;
196
- cacheEvictBuilder . setBeforeInvocation ( cacheEvictOperation . isBeforeInvocation ()) ;
197
- cacheEvictBuilder .setCacheWide (cacheEvictOperation .isCacheWide ());
198
- builder = cacheEvictBuilder ;
199
- }
200
- else {
201
- CachePutOperation cachePutOperation = ( CachePutOperation ) operation ;
202
- CachePutOperation . Builder cachePutBuilder = new CachePutOperation . Builder () ;
203
- String unless = cachePutOperation . getUnless ();
204
- if ( unless != null ) {
205
- cachePutBuilder . setUnless (unless );
206
- }
207
- builder = cachePutBuilder ;
208
- }
209
-
210
- builder .setName (operation .getName ());
211
- builder .setCacheManager (operation .getCacheManager ());
212
- builder .setCacheNames (this .cacheNames );
213
- builder .setCacheResolver (operation .getCacheResolver ());
214
- builder .setCondition (operation .getCondition ());
215
- builder .setKey (operation .getKey ());
216
- builder .setKeyGenerator (operation .getKeyGenerator ());
217
- return builder .build ();
218
- })
219
- .collect (Collectors .toList ());
179
+ cacheOperationsToUse =
180
+ this . cacheOperations . stream ( )
181
+ . filter ((operation ) -> ObjectUtils . isEmpty ( operation . getCacheNames ()))
182
+ . map (( operation ) -> {
183
+ CacheOperation . Builder builder ;
184
+ if ( operation instanceof CacheableOperation ) {
185
+ CacheableOperation cacheableOperation = ( CacheableOperation ) operation ;
186
+ CacheableOperation . Builder cacheableBuilder = new CacheableOperation . Builder ( );
187
+ cacheableBuilder . setSync ( cacheableOperation .isSync () );
188
+ String unless = cacheableOperation . getUnless ();
189
+ if (unless != null ) {
190
+ cacheableBuilder . setUnless ( unless );
191
+ }
192
+ builder = cacheableBuilder ;
193
+ }
194
+ else if ( operation instanceof CacheEvictOperation ) {
195
+ CacheEvictOperation . Builder cacheEvictBuilder = new CacheEvictOperation . Builder () ;
196
+ CacheEvictOperation cacheEvictOperation = ( CacheEvictOperation ) operation ;
197
+ cacheEvictBuilder .setBeforeInvocation (cacheEvictOperation .isBeforeInvocation ());
198
+ cacheEvictBuilder . setCacheWide ( cacheEvictOperation . isCacheWide ()) ;
199
+ builder = cacheEvictBuilder ;
200
+ }
201
+ else {
202
+ CachePutOperation cachePutOperation = ( CachePutOperation ) operation ;
203
+ CachePutOperation . Builder cachePutBuilder = new CachePutOperation . Builder ();
204
+ String unless = cachePutOperation . getUnless ();
205
+ if (unless != null ) {
206
+ cachePutBuilder . setUnless ( unless );
207
+ }
208
+ builder = cachePutBuilder ;
209
+ }
210
+ builder .setName (operation .getName ());
211
+ builder .setCacheManager (operation .getCacheManager ());
212
+ builder .setCacheNames (this .cacheNames );
213
+ builder .setCacheResolver (operation .getCacheResolver ());
214
+ builder .setCondition (operation .getCondition ());
215
+ builder .setKey (operation .getKey ());
216
+ builder .setKeyGenerator (operation .getKeyGenerator ());
217
+ return builder .build ();
218
+ })
219
+ .collect (Collectors .toList ());
220
220
}
221
221
else {
222
- cacheOperations = this .cacheOperations ;
222
+ cacheOperationsToUse = this .cacheOperations ;
223
223
}
224
224
225
225
this .delegate .setBeanFactory (getBeanFactory ());
226
226
EvaluationContext evaluationContext = ExpressionUtils .createStandardEvaluationContext (getBeanFactory ());
227
227
this .delegate .setKeyGenerator ((target , method , params ) ->
228
228
this .keyExpression .getValue (evaluationContext , params [0 ])); // NOSONAR
229
- this .delegate .setCacheOperationSources ((method , targetClass ) -> cacheOperations );
229
+ this .delegate .setCacheOperationSources ((method , targetClass ) -> cacheOperationsToUse );
230
230
this .delegate .afterPropertiesSet ();
231
231
232
232
}
0 commit comments