Esempio n. 1
0
 /**
  * 构造器
  *
  * @param target 目标控制器对象
  * @param rootMapping 控制器根请求映射
  * @param method 方法
  * @param interceptors 控制器根拦截器集合
  */
 @SuppressWarnings("unchecked")
 public RequestMeta(
     Object target,
     String rootMapping,
     Method method,
     List<PairObject<Class<IFilter>, String>> interceptors) {
   this.target = target;
   this.mapping = this.buildRequestMapping(rootMapping, method);
   this.method = method;
   RequestMetodHandler _handlerAnno = method.getAnnotation(RequestMetodHandler.class);
   if (_handlerAnno != null && _handlerAnno.value() != null) {
     this.handler = ClassUtils.impl(_handlerAnno.value(), IRequestMethodHandler.class);
   } else {
     this.handler = null;
   }
   this.methodParamNames = ClassUtils.getMethodParamNames(method);
   this.parameterTypes = method.getParameterTypes();
   // 处理控制器方法对象声明的拦截器
   boolean hasInterceptorClean = method.isAnnotationPresent(FilterClean.class);
   List<PairObject<Class<IFilter>, String>> _interceptors =
       hasInterceptorClean
           ? new ArrayList<PairObject<Class<IFilter>, String>>()
           : new ArrayList<PairObject<Class<IFilter>, String>>(interceptors);
   FilterGroup _interceptorGroup = method.getAnnotation(FilterGroup.class);
   if (_interceptorGroup != null
       && _interceptorGroup.value() != null
       && _interceptorGroup.value().length > 0) {
     Filter[] _interceptorArray = _interceptorGroup.value();
     if (_interceptorArray != null && _interceptorArray.length > 0) {
       for (Filter _interceptor : _interceptorArray) {
         _interceptors.add(
             new PairObject<Class<IFilter>, String>(
                 (Class<IFilter>) _interceptor.value(), _interceptor.params()));
       }
     }
   } else {
     Filter _interceptor = method.getAnnotation(Filter.class);
     if (_interceptor != null) {
       _interceptors.add(
           new PairObject<Class<IFilter>, String>(
               (Class<IFilter>) _interceptor.value(), _interceptor.params()));
     }
   }
   this.interceptors = _interceptors;
 }