@Override public void process(Element element, EComponentHolder holder) throws Exception { ExecutableElement executableElement = (ExecutableElement) element; JMethod delegatingMethod = codeModelHelper.overrideAnnotatedMethod(executableElement, holder); JBlock previousBody = codeModelHelper.removeBody(delegatingMethod); JDefinedClass anonymousRunnableClass = codeModelHelper.createDelegatingAnonymousRunnableClass(previousBody); UiThread annotation = element.getAnnotation(UiThread.class); long delay = annotation.delay(); UiThread.Propagation propagation = annotation.propagation(); if (delay == 0 && propagation == UiThread.Propagation.REUSE) { // Put in the check for the UI thread. addUIThreadCheck(delegatingMethod, previousBody, holder); } delegatingMethod.body().add(getJClass(UiThreadExecutor.class).staticInvoke(METHOD_RUN_TASK) // .arg(annotation.id()) // .arg(_new(anonymousRunnableClass)) // .arg(lit(delay))); }
@Override public void process(Element element, EComponentHolder holder) throws Exception { ExecutableElement executableElement = (ExecutableElement) element; JMethod delegatingMethod = codeModelHelper.overrideAnnotatedMethod(executableElement, holder); JBlock previousBody = codeModelHelper.removeBody(delegatingMethod); JDefinedClass anonymousRunnableClass = codeModelHelper.createDelegatingAnonymousRunnableClass(previousBody); UiThread annotation = element.getAnnotation(UiThread.class); long delay = annotation.delay(); UiThread.Propagation propagation = annotation.propagation(); if (delay == 0 && propagation == UiThread.Propagation.REUSE) { // Put in the check for the UI thread. addUIThreadCheck(delegatingMethod, previousBody, holder); } delegatingMethod.body().add(getJClass(UiThreadExecutor.class).staticInvoke(METHOD_RUN_TASK) // .arg(annotation.id()) // .arg(_new(anonymousRunnableClass)) // .arg(lit(delay))); }