Ejemplo n.º 1
0
 @Override
 public String exe(Element element, int position, List<RenderItem> items) {
   @SuppressWarnings("unchecked")
   List<AbstractNode> contentList = element.content();
   int i = 0;
   for (int cursor = 0; i < contentList.size(); ++i) {
     Object unit = contentList.get(i);
     if (unit instanceof Element) {
       Element subEle = (Element) unit;
       Resolver resolver = ResolverFactory.create(subEle.getName());
       String resolveResult = resolver.exe(subEle, position + cursor, items);
       contentList.set(i, new DefaultText(resolveResult));
     }
     cursor += ((DefaultText) contentList.get(i)).getText().length();
   }
   return element.getStringValue();
 }
 public MethodParameterResolver(
     Class<?> controllerClazz,
     Method method,
     ParameterNameDiscovererImpl parameterNameDiscoverer,
     ResolverFactory resolverFactory) {
   this.method = method;
   Class<?>[] parameterTypes = method.getParameterTypes();
   parameterNames = parameterNameDiscoverer.getParameterNames(method);
   resolvers = new ParamResolver[parameterTypes.length];
   paramMetaDatas = new ParamMetaData[parameterTypes.length];
   //
   for (int i = 0; i < parameterTypes.length; i++) {
     ParamMetaDataImpl paramMetaData =
         new ParamMetaDataImpl(controllerClazz, method, parameterTypes[i], parameterNames[i], i);
     paramMetaDatas[i] = paramMetaData;
     resolvers[i] = resolverFactory.supports(paramMetaData);
   }
 }