protected CacheableMethod resolveCacheableMethod(final MethodInvocation methodInvocation) {
        val targetMethod = methodInvocation.getMethod();
        val targetClass = targetMethod.getDeclaringClass();

        for (val method : CacheableMethod.values()) {
            Method cacheableMethod = null;
            try {
                cacheableMethod = targetClass.getMethod(method.getName(), method.getArgs());
            } catch (final SecurityException e) {
                LOGGER.warn("Security exception while attempting to if the target class [{}] implements the cacheable method [{}]", targetClass, cacheableMethod, e);
            } catch (final NoSuchMethodException e) {
                LOGGER.warn("Target class [{}] does not implement possible cacheable method [{}].", targetClass, cacheableMethod);
            }
            if (targetMethod.equals(cacheableMethod)) {
                return method;
            }
        }
        throw new IllegalArgumentException("Do not know how to generate a cache entry for " + targetMethod + " on class " + targetClass);
    }
Iterates over the {@link CacheableMethod} instances to determine which instance the
passed {@link MethodInvocation} applies to.

@param methodInvocation method invocation
@return Cacheable method
support/cas-server-support-person-directory-core/src/main/java/org/apereo/cas/persondir/cache/AttributeBasedCacheKeyGenerator.java