/** * Constructs an InterceptorStack with the given interceptors * * @param interceptors */ public InterceptorStack(Class<? extends Interceptor>... interceptorClasses) { if (interceptorClasses == null) { throw new NullPointerException(); } this.interceptors = new ArrayList<InterceptorType>(); for (Class<? extends Interceptor> interceptorClass : interceptorClasses) { InterceptorType type = InterceptorType.getType(interceptorClass); interceptors.add(type); } }
public ComponentType getComponentType(Class<?> type) throws InvalidComponentException { String componentName = getComponentName(type); if (!type.isAnnotationPresent(Component.class)) { LOG.warn( "Deprecated: registering " + type.getName() + " component without @Component annotation."); } if (LOG.isDebugEnabled()) { LOG.debug("Component found: " + componentName + " from " + type.getName()); } ScopeType scope = getScope(type); Clazz clazz = new Clazz(type); BeanConstructor constructor = clazz.findSingleConstructor(); LOG.debug("Registered constructor: " + constructor); Map<String, DefaultLogicMethod> actions = factory.loadLogics(type); List<InterceptorType> interceptors = InterceptorType.getInterceptors(type); // read fields List<FieldAnnotation<In>> ins = ReflectionUtil.readAnnotations(type, In.class); // destroy method String destroyLogicName = getDestroyLogicName(type); LOG.debug("Component clazz " + type.getName() + " read"); List<ReadParameter> reads = findParameters(type); DefaultComponentType componentType = new DefaultComponentType( type, componentName, scope, constructor, actions, ins, interceptors, destroyLogicName, reads); for (DefaultLogicMethod method : actions.values()) { method.setComponentType(componentType); } return componentType; }