ViewService(final ViewConfiguration viewConfiguration) { viewClass = viewConfiguration.getViewClass(); final ProxyFactory<?> proxyFactory = viewConfiguration.getProxyFactory(); this.proxyFactory = proxyFactory; final Method[] methods = proxyFactory.getCachedMethods(); final int methodCount = methods.length; viewPostConstruct = Interceptors.getChainedInterceptorFactory( viewConfiguration.getViewPostConstructInterceptors()); viewPreDestroy = Interceptors.getChainedInterceptorFactory( viewConfiguration.getViewPreDestroyInterceptors()); clientPostConstruct = Interceptors.getChainedInterceptorFactory( viewConfiguration.getClientPostConstructInterceptors()); clientPreDestroy = Interceptors.getChainedInterceptorFactory( viewConfiguration.getClientPreDestroyInterceptors()); final IdentityHashMap<Method, InterceptorFactory> viewInterceptorFactories = new IdentityHashMap<Method, InterceptorFactory>(methodCount); final IdentityHashMap<Method, InterceptorFactory> clientInterceptorFactories = new IdentityHashMap<Method, InterceptorFactory>(methodCount); for (Method method : methods) { if (method.getName().equals("finalize") && method.getParameterTypes().length == 0) { viewInterceptorFactories.put(method, DESTROY_INTERCEPTOR); } else { viewInterceptorFactories.put( method, Interceptors.getChainedInterceptorFactory( viewConfiguration.getViewInterceptorDeque(method))); clientInterceptorFactories.put( method, Interceptors.getChainedInterceptorFactory( viewConfiguration.getClientInterceptorDeque(method))); } } this.viewInterceptorFactories = viewInterceptorFactories; this.clientInterceptorFactories = clientInterceptorFactories; allowedMethods = Collections.unmodifiableSet(viewInterceptorFactories.keySet()); }