DefaultCacheableKeyFactory implements CacheableMethodKeyFactory,
    Serializable { @Override public CacheKeyInfo createKey(ProceedingJoinPoint point) { Object[] args = point.getArgs(); if (args.length != _keyFactories.length) throw new IllegalArgumentException(); if (args.length == 1) return _keyFactories[0].createKey(args[0]); KeyImpl keys = new KeyImpl(args.length); boolean refreshCache = false; for (int i = 0; i < args.length; i++) { CacheKeyInfo keyInfo = _keyFactories[i].createKey(args[i]); keys.set(i, keyInfo.getKey()); refreshCache |= keyInfo.isCacheRefreshIndicated(); } return new CacheKeyInfo(keys, refreshCache); } DefaultCacheableKeyFactory(CacheableObjectKeyFactory[] keyFactories); int getNumberOfObjectKeyFactories(); CacheableObjectKeyFactory getObjectKeyFactory(int i); @Override CacheKeyInfo createKey(ProceedingJoinPoint point);  }
@Test public void test01() throws SecurityException, NoSuchMethodException { MockServiceImpl service = new MockServiceImpl(); Method method = MockService.class.getMethod("evalaute", String.class); ProceedingJoinPoint pjp = ProceedingJoinPointFactory.create(service, service, MockService.class, method, "value"); CacheableObjectKeyFactory[] keyFactories = {new DefaultCacheableObjectKeyFactory()}; DefaultCacheableKeyFactory factory = new DefaultCacheableKeyFactory( keyFactories); CacheKeyInfo keyInfo = factory.createKey(pjp); assertEquals("value", keyInfo.getKey()); }
@Test public void test02() throws SecurityException, NoSuchMethodException { MockServiceImpl service = new MockServiceImpl(); Method method = MockService.class.getMethod("evalauteMultiArg", String.class, String.class); ProceedingJoinPoint pjp = ProceedingJoinPointFactory.create(service, service, MockService.class, method, "valueA", "valueB"); CacheableObjectKeyFactory[] keyFactories = { new DefaultCacheableObjectKeyFactory(), new DefaultCacheableObjectKeyFactory()}; DefaultCacheableKeyFactory factory = new DefaultCacheableKeyFactory( keyFactories); DefaultCacheableKeyFactory.KeyImpl expected = new DefaultCacheableKeyFactory.KeyImpl( new Serializable[] {"valueA", "valueB"}); CacheKeyInfo keyInfo = factory.createKey(pjp); assertEquals(expected, keyInfo.getKey()); }