public void validate(Class<? extends Annotation> expectedAnnotation, Element element, ElementValidation valid) { Element enclosingElement = element.getEnclosingElement(); if (element instanceof VariableElement && enclosingElement instanceof ExecutableElement) { validatorHelper.param.annotatedWith(expectedAnnotation).multiple().validate((ExecutableElement) enclosingElement, valid); validatorHelper.doesNotHaveAnyOfSupportedAnnotations(enclosingElement, valid); handler.validateEnclosingElement(enclosingElement, valid); } else if (element instanceof ExecutableElement) { handler.validateEnclosingElement(element, valid); validatorHelper.param.anyType().validate((ExecutableElement) element, valid); List<? extends VariableElement> parameters = ((ExecutableElement) element).getParameters(); for (VariableElement param : parameters) { validatorHelper.doesNotHaveAnyOfSupportedAnnotations(param, valid); } } else { handler.validateEnclosingElement(element, valid); validatorHelper.isNotFinal(element, valid); } }
public void validate(Class<? extends Annotation> expectedAnnotation, Element element, ElementValidation valid) { Element enclosingElement = element.getEnclosingElement(); if (element instanceof VariableElement && enclosingElement instanceof ExecutableElement) { validatorHelper.param.annotatedWith(expectedAnnotation).multiple().validate((ExecutableElement) enclosingElement, valid); validatorHelper.doesNotHaveAnyOfSupportedAnnotations(enclosingElement, valid); handler.validateEnclosingElement(enclosingElement, valid); } else if (element instanceof ExecutableElement) { handler.validateEnclosingElement(element, valid); validatorHelper.param.anyType().validate((ExecutableElement) element, valid); List<? extends VariableElement> parameters = ((ExecutableElement) element).getParameters(); for (VariableElement param : parameters) { validatorHelper.doesNotHaveAnyOfSupportedAnnotations(param, valid); } } else { handler.validateEnclosingElement(element, valid); validatorHelper.isNotFinal(element, valid); } }