@Override public Void visitAnnotation(AnnotationMirror a, JAnnotationArrayMember p) { helper.copyAnnotation(p, a); return null; } }
private void addOttoAnnotation(ExecutableElement element, JMethod method) { for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { if (annotationMirror.getAnnotationType().toString().equals(getTarget())) { codeModelHelper.copyAnnotation(method, annotationMirror); break; } } }
public void copyNonAAAnnotations(IJAnnotatable annotatable, List<? extends AnnotationMirror> annotationMirrors) { for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().asElement().getAnnotation(Inherited.class) == null) { AbstractJClass annotationClass = typeMirrorToJClass(annotationMirror.getAnnotationType()); if (!environment.isAndroidAnnotation(annotationClass.fullName()) && !IGNORED_ANNOTATIONS.contains(annotationClass.fullName())) { copyAnnotation(annotatable, annotationMirror); } } } }
@Override public Void visitAnnotation(AnnotationMirror a, JAnnotationArrayMember p) { helper.copyAnnotation(p, a); return null; } }
public void copyNonAAAnnotations(IJAnnotatable annotatable, List<? extends AnnotationMirror> annotationMirrors) { for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().asElement().getAnnotation(Inherited.class) == null) { AbstractJClass annotationClass = typeMirrorToJClass(annotationMirror.getAnnotationType()); if (!environment.isAndroidAnnotation(annotationClass.fullName()) && !IGNORED_ANNOTATIONS.contains(annotationClass.fullName())) { copyAnnotation(annotatable, annotationMirror); } } } }
private void setPermissionMethods(Element element, EComponentHolder holder, AbstractJClass delegateClass, JFieldVar dispatcherCalledField) { ExecutableElement executableElement = (ExecutableElement) element; JMethod overrideMethod = codeModelHelper.overrideAnnotatedMethod(executableElement, holder); JBlock previousMethodBody = codeModelHelper.removeBody(overrideMethod); JBlock overrideMethodBody = overrideMethod.body(); JConditional conditional = overrideMethodBody._if(dispatcherCalledField.not()); JBlock thenBlock = conditional._then(); thenBlock.assign(dispatcherCalledField, JExpr.TRUE); String delegateMethodName = element.getSimpleName().toString() + "WithPermissionCheck"; JInvocation delegateCall = delegateClass.staticInvoke(delegateMethodName) .arg(JExpr._this()); overrideMethod.params().forEach(delegateCall::arg); if (overrideMethod.hasVarArgs()) { JVar jVar = overrideMethod.varParam(); if (jVar != null) { delegateCall.arg(jVar); } } if (!removeRuntimePermissionsAnnotation(holder.getGeneratedClass())) { codeModelHelper.copyAnnotation(overrideMethod, findAnnotation(element)); } thenBlock.add(delegateCall); JBlock elseBlock = conditional._else(); elseBlock.assign(dispatcherCalledField, JExpr.FALSE); elseBlock.add(previousMethodBody); }