@Nullable private JCacheOperation<?> computeCacheOperation(Method method, @Nullable Class<?> targetClass) { // Don't allow no-public methods as required. if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { return null; } // The method may be on an interface, but we need attributes from the target class. // If the target class is null, the method will be unchanged. Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass); // First try is the method in the target class. JCacheOperation<?> operation = findCacheOperation(specificMethod, targetClass); if (operation != null) { return operation; } if (specificMethod != method) { // Fallback is to look at the original method. operation = findCacheOperation(method, targetClass); if (operation != null) { return operation; } } return null; }
@Override public JCacheOperation<?> getCacheOperation(Method method, @Nullable Class<?> targetClass) { MethodClassKey cacheKey = new MethodClassKey(method, targetClass); Object cached = this.cache.get(cacheKey); if (cached != null) { return (cached != NULL_CACHING_ATTRIBUTE ? (JCacheOperation<?>) cached : null); } else { JCacheOperation<?> operation = computeCacheOperation(method, targetClass); if (operation != null) { if (logger.isDebugEnabled()) { logger.debug("Adding cacheable method '" + method.getName() + "' with operation: " + operation); } this.cache.put(cacheKey, operation); } else { this.cache.put(cacheKey, NULL_CACHING_ATTRIBUTE); } return operation; } }
@Nullable private JCacheOperation<?> computeCacheOperation(Method method, @Nullable Class<?> targetClass) { // Don't allow no-public methods as required. if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { return null; } // The method may be on an interface, but we need attributes from the target class. // If the target class is null, the method will be unchanged. Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass); // First try is the method in the target class. JCacheOperation<?> operation = findCacheOperation(specificMethod, targetClass); if (operation != null) { return operation; } if (specificMethod != method) { // Fallback is to look at the original method. operation = findCacheOperation(method, targetClass); if (operation != null) { return operation; } } return null; }
@Override public JCacheOperation<?> getCacheOperation(Method method, @Nullable Class<?> targetClass) { MethodClassKey cacheKey = new MethodClassKey(method, targetClass); Object cached = this.cache.get(cacheKey); if (cached != null) { return (cached != NULL_CACHING_ATTRIBUTE ? (JCacheOperation<?>) cached : null); } else { JCacheOperation<?> operation = computeCacheOperation(method, targetClass); if (operation != null) { if (logger.isDebugEnabled()) { logger.debug("Adding cacheable method '" + method.getName() + "' with operation: " + operation); } this.cache.put(cacheKey, operation); } else { this.cache.put(cacheKey, NULL_CACHING_ATTRIBUTE); } return operation; } }
private JCacheOperation<?> computeCacheOperation(Method method, Class<?> targetClass) { // Don't allow no-public methods as required. if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { return null; } // The method may be on an interface, but we need attributes from the target class. // If the target class is null, the method will be unchanged. Method specificMethod = ClassUtils.getMostSpecificMethod(method, targetClass); // If we are dealing with method with generic parameters, find the original method. specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod); // First try is the method in the target class. JCacheOperation<?> operation = findCacheOperation(specificMethod, targetClass); if (operation != null) { return operation; } if (specificMethod != method) { // Fallback is to look at the original method. operation = findCacheOperation(method, targetClass); if (operation != null) { return operation; } } return null; }
@Override public JCacheOperation<?> getCacheOperation(Method method, Class<?> targetClass) { MethodClassKey cacheKey = new MethodClassKey(method, targetClass); Object cached = this.cache.get(cacheKey); if (cached != null) { return (cached != NULL_CACHING_ATTRIBUTE ? (JCacheOperation<?>) cached : null); } else { JCacheOperation<?> operation = computeCacheOperation(method, targetClass); if (operation != null) { if (logger.isDebugEnabled()) { logger.debug("Adding cacheable method '" + method.getName() + "' with operation: " + operation); } this.cache.put(cacheKey, operation); } else { this.cache.put(cacheKey, NULL_CACHING_ATTRIBUTE); } return operation; } }