Exemplo n.º 1
0
  @Override
  public void process(Element element, EBeanHolder holder) {
    final ExecutableElement afterPutMethod = (ExecutableElement) element;
    final UseModelHolder useModelHolder = holder.getPluginHolder(new UseModelHolder(holder));
    useModelHolder.setAfterPutMethod(afterPutMethod);

    List<Class<? extends Annotation>> annotations =
        Arrays.asList(UseModel.class, LocalDBModel.class, ServerModel.class);
    for (Class<? extends Annotation> annotation : annotations) {
      if (element.getAnnotation(annotation) != null) return;
    }

    List<? extends VariableElement> parameters = afterPutMethod.getParameters();

    JInvocation invocation =
        useModelHolder
            .getPutModelInitBlock()
            ._if(ref("result").ne(_null()))
            ._then()
            .invoke(afterPutMethod.getSimpleName().toString());

    for (VariableElement param : parameters) {
      final String paramName = param.getSimpleName().toString();
      ParamUtils.injectParam(paramName, invocation);
    }
  }
Exemplo n.º 2
0
  @Override
  public void process(Element element, EComponentWithViewSupportHolder holder) throws Exception {

    ActionScanner.processActions(element, holder);

    uniquePriorityCounter++;

    final ViewsHolder viewsHolder =
        holder.getPluginHolder(new ViewsHolder(holder, annotationHelper));
    final String methodName = element.getSimpleName().toString();

    JBlock block = new JBlock();
    JInvocation invoke = block.invoke(methodName);

    ExecutableElement exeElem = (ExecutableElement) element;
    for (VariableElement param : exeElem.getParameters()) {
      final String paramName = param.getSimpleName().toString();
      ParamUtils.injectParam(paramName, invoke, viewsHolder);
    }

    SharedRecords.priorityAdd(holder.getOnViewChangedBody(), block, uniquePriorityCounter);
  }