@Test public void testNoInheritance() throws NoSuchMethodException { Method cacheKeyMethod = cacheKeyMethodStoreImpl.getKeyMethod(Object.class); assertNotNull(cacheKeyMethod); assertEquals("toString", cacheKeyMethod.getName()); cacheKeyMethod = cacheKeyMethodStoreImpl.getKeyMethod(Point.class); assertNotNull(cacheKeyMethod); assertEquals("getKey", cacheKeyMethod.getName()); }
@Override public Method getKeyMethod(final Class<?> keyClass) throws NoSuchMethodException { final Method storedMethod = find(keyClass); if (storedMethod != null) { return storedMethod; } Method targetMethod = getFromClass(keyClass); if (targetMethod == null) { Class<?> superKeyClass = keyClass.getSuperclass(); if (superKeyClass != null) { targetMethod = getKeyMethod(superKeyClass); } if (targetMethod == null || DEFAULT_KEY_METHOD_NAME.equals(targetMethod.getName())) { targetMethod = keyClass.getMethod(DEFAULT_KEY_METHOD_NAME, (Class<?>[]) null); } } add(keyClass, targetMethod); return targetMethod; }
CacheKeyMethodStoreImpl implements CacheKeyMethodStore { @Override public Method getKeyMethod(final Class<?> keyClass) throws NoSuchMethodException { final Method storedMethod = find(keyClass); if (storedMethod != null) { return storedMethod; } Method targetMethod = getFromClass(keyClass); if (targetMethod == null) { Class<?> superKeyClass = keyClass.getSuperclass(); if (superKeyClass != null) { targetMethod = getKeyMethod(superKeyClass); } if (targetMethod == null || DEFAULT_KEY_METHOD_NAME.equals(targetMethod.getName())) { targetMethod = keyClass.getMethod(DEFAULT_KEY_METHOD_NAME, (Class<?>[]) null); } } add(keyClass, targetMethod); return targetMethod; } }
CacheKeyMethodStoreImpl implements CacheKeyMethodStore { @Override public Method getKeyMethod(final Class<?> keyClass) throws NoSuchMethodException { final Method storedMethod = find(keyClass); if (storedMethod != null) { return storedMethod; } Method targetMethod = getFromClass(keyClass); if (targetMethod == null) { Class<?> superKeyClass = keyClass.getSuperclass(); if (superKeyClass != null) { targetMethod = getKeyMethod(superKeyClass); } if (targetMethod == null || DEFAULT_KEY_METHOD_NAME.equals(targetMethod.getName())) { targetMethod = keyClass.getMethod(DEFAULT_KEY_METHOD_NAME, (Class<?>[]) null); } } add(keyClass, targetMethod); return targetMethod; }  }
CacheKeyMethodStoreImpl implements CacheKeyMethodStore { @Override public Method getKeyMethod(final Class<?> keyClass) throws NoSuchMethodException { final Method storedMethod = find(keyClass); if (storedMethod != null) { return storedMethod; } Method targetMethod = getFromClass(keyClass); if (targetMethod == null) { Class<?> superKeyClass = keyClass.getSuperclass(); if (superKeyClass != null) { targetMethod = getKeyMethod(superKeyClass); } if (targetMethod == null || DEFAULT_KEY_METHOD_NAME.equals(targetMethod.getName())) { targetMethod = keyClass.getMethod(DEFAULT_KEY_METHOD_NAME, (Class<?>[]) null); } } add(keyClass, targetMethod); return targetMethod; }  @Override Method getKeyMethod(final Class<?> keyClass); }
CacheKeyMethodStoreImpl implements CacheKeyMethodStore { @Override public Method getKeyMethod(final Class<?> keyClass) throws NoSuchMethodException { final Method storedMethod = find(keyClass); if (storedMethod != null) { return storedMethod; } Method targetMethod = getFromClass(keyClass); if (targetMethod == null) { Class<?> superKeyClass = keyClass.getSuperclass(); if (superKeyClass != null) { targetMethod = getKeyMethod(superKeyClass); } if (targetMethod == null || DEFAULT_KEY_METHOD_NAME.equals(targetMethod.getName())) { targetMethod = keyClass.getMethod(DEFAULT_KEY_METHOD_NAME, (Class<?>[]) null); } } add(keyClass, targetMethod); return targetMethod; }  @Override Method getKeyMethod(final Class<?> keyClass); static final String DEFAULT_KEY_METHOD_NAME; }