public void invoke(MethodInvocation invocation) throws Throwable {
      next.invoke(invocation);
      if (invocation.found() || invocation.getParameterTypes().length != 1) {
        return;
      }

      if (!invocation.isIsOrGet()) {
        return;
      }

      MethodInvocation getterInvocation =
          new MethodInvocation(
              invocation.getName(),
              invocation.getReturnType(),
              invocation.getGenericReturnType(),
              EMPTY_CLASS_ARRAY,
              invocation.getDelegate(),
              EMPTY);
      next.invoke(getterInvocation);
      if (getterInvocation.found() && getterInvocation.getResult() != null) {
        invocation.setResult(getterInvocation.getResult());
      } else {
        invocation.setResult(invocation.getParameters()[0]);
      }
    }
    public void invoke(MethodInvocation invocation) throws Throwable {
      if (current.get() != null) {
        // Already invoking a method on the mix-in
        return;
      }

      if (instance == null) {
        instance = DirectInstantiator.INSTANCE.newInstance(mixInClass, proxy);
      }
      MethodInvocation beanInvocation =
          new MethodInvocation(
              invocation.getName(),
              invocation.getReturnType(),
              invocation.getGenericReturnType(),
              invocation.getParameterTypes(),
              instance,
              invocation.getParameters());
      current.set(beanInvocation);
      try {
        next.invoke(beanInvocation);
      } finally {
        current.set(null);
      }
      if (beanInvocation.found()) {
        invocation.setResult(beanInvocation.getResult());
      }
    }
 public Method get(MethodInvocation invocation) {
   Class<?> owner = invocation.getDelegate().getClass();
   String name = invocation.getName();
   Class<?>[] parameterTypes = invocation.getParameterTypes();
   MethodInvocationKey key = new MethodInvocationKey(owner, name, parameterTypes);
   lock.readLock().lock();
   Optional<Method> cached = store.get(key);
   if (cached == null) {
     cacheMiss++;
     lock.readLock().unlock();
     lock.writeLock().lock();
     try {
       cached = store.get(key);
       if (cached == null) {
         cached = lookup(owner, name, parameterTypes);
         if (cacheMiss % 10 == 0) {
           removeDirtyEntries();
         }
         store.put(key, cached);
       }
       lock.readLock().lock();
     } finally {
       lock.writeLock().unlock();
     }
   } else {
     cacheHit++;
   }
   try {
     return cached.orNull();
   } finally {
     lock.readLock().unlock();
   }
 }