public DeclaredType extractAnnotationClassParameter(Element element, String annotationName, String methodName) { AnnotationMirror annotationMirror = findAnnotationMirror(element, annotationName); Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = annotationMirror.getElementValues(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : elementValues.entrySet()) { /* * "methodName" is unset when the default value is used */ if (methodName.equals(entry.getKey().getSimpleName().toString())) { AnnotationValue annotationValue = entry.getValue(); return (DeclaredType) annotationValue.getValue(); } } return null; }
public List<DeclaredType> extractAnnotationClassArrayParameter(Element element, String annotationName, String methodName) { AnnotationMirror annotationMirror = findAnnotationMirror(element, annotationName); Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = annotationMirror.getElementValues(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : elementValues.entrySet()) { /* * "methodName" is unset when the default value is used */ if (methodName.equals(entry.getKey().getSimpleName().toString())) { AnnotationValue annotationValue = entry.getValue(); @SuppressWarnings("unchecked") List<AnnotationValue> annotationClassArray = (List<AnnotationValue>) annotationValue.getValue(); List<DeclaredType> result = new ArrayList<>(annotationClassArray.size()); for (AnnotationValue annotationClassValue : annotationClassArray) { result.add((DeclaredType) annotationClassValue.getValue()); } return result; } } return null; }
public DeclaredType extractAnnotationClassParameter(Element element, String annotationName, String methodName) { AnnotationMirror annotationMirror = findAnnotationMirror(element, annotationName); Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = annotationMirror.getElementValues(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : elementValues.entrySet()) { /* * "methodName" is unset when the default value is used */ if (methodName.equals(entry.getKey().getSimpleName().toString())) { AnnotationValue annotationValue = entry.getValue(); return (DeclaredType) annotationValue.getValue(); } } return null; }
public List<DeclaredType> extractAnnotationClassArrayParameter(Element element, String annotationName, String methodName) { AnnotationMirror annotationMirror = findAnnotationMirror(element, annotationName); Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = annotationMirror.getElementValues(); for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : elementValues.entrySet()) { /* * "methodName" is unset when the default value is used */ if (methodName.equals(entry.getKey().getSimpleName().toString())) { AnnotationValue annotationValue = entry.getValue(); @SuppressWarnings("unchecked") List<AnnotationValue> annotationClassArray = (List<AnnotationValue>) annotationValue.getValue(); List<DeclaredType> result = new ArrayList<>(annotationClassArray.size()); for (AnnotationValue annotationClassValue : annotationClassArray) { result.add((DeclaredType) annotationClassValue.getValue()); } return result; } } return null; }