@Test public void staticHandlersShouldBeCached() throws Exception { InterceptorHandler handler = factory.handlerFor(ALazyInterceptor.class); assertThat(factory.handlerFor(ALazyInterceptor.class), is(sameInstance(handler))); }
public InterceptorHandler handlerFor(Class<? extends Interceptor> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } return new ToInstantiateInterceptorHandler(container, type); }
DefaultInterceptorHandlerFactory implements InterceptorHandlerFactory { public InterceptorHandler handlerFor(Class<? extends Interceptor> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } return new ToInstantiateInterceptorHandler(container, type); } }
DefaultInterceptorHandlerFactory implements InterceptorHandlerFactory { public InterceptorHandler handlerFor(Class<? extends Interceptor> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } return new ToInstantiateInterceptorHandler(container, type); } DefaultInterceptorHandlerFactory(Container container); }
DefaultInterceptorHandlerFactory implements InterceptorHandlerFactory { public InterceptorHandler handlerFor(Class<? extends Interceptor> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } return new ToInstantiateInterceptorHandler(container, type); } DefaultInterceptorHandlerFactory(Container container); InterceptorHandler handlerFor(Class<? extends Interceptor> type); }
DefaultInterceptorHandlerFactory implements InterceptorHandlerFactory { public InterceptorHandler handlerFor(Class<? extends Interceptor> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } return new ToInstantiateInterceptorHandler(container, type); } DefaultInterceptorHandlerFactory(Container container); InterceptorHandler handlerFor(Class<? extends Interceptor> type);  }