@Override @Nullable public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) { // look for direct name match String methodName = method.getName(); Collection<CacheOperation> ops = this.nameMap.get(methodName); if (ops == null) { // Look for most specific name match. String bestNameMatch = null; for (String mappedName : this.nameMap.keySet()) { if (isMatch(methodName, mappedName) && (bestNameMatch == null || bestNameMatch.length() <= mappedName.length())) { ops = this.nameMap.get(mappedName); bestNameMatch = mappedName; } } } return ops; }
CacheOperationSource newCacheOperationSource(String methodName, CacheOperation... cacheOperations) { NameMatchCacheOperationSource cacheOperationSource = new NameMatchCacheOperationSource(); cacheOperationSource.addCacheMethod(methodName, Arrays.asList(cacheOperations)); return cacheOperationSource; }
@Override @Nullable public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) { // look for direct name match String methodName = method.getName(); Collection<CacheOperation> ops = this.nameMap.get(methodName); if (ops == null) { // Look for most specific name match. String bestNameMatch = null; for (String mappedName : this.nameMap.keySet()) { if (isMatch(methodName, mappedName) && (bestNameMatch == null || bestNameMatch.length() <= mappedName.length())) { ops = this.nameMap.get(mappedName); bestNameMatch = mappedName; } } } return ops; }
@Override @Nullable public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) { // look for direct name match String methodName = method.getName(); Collection<CacheOperation> ops = this.nameMap.get(methodName); if (ops == null) { // Look for most specific name match. String bestNameMatch = null; for (String mappedName : this.nameMap.keySet()) { if (isMatch(methodName, mappedName) && (bestNameMatch == null || bestNameMatch.length() <= mappedName.length())) { ops = this.nameMap.get(mappedName); bestNameMatch = mappedName; } } } return ops; }