/** * Use together with {@link #toAnnotationInstance(Class, Annotation)}. * * @see #getAnnotationClassesAsStrings(java.lang.annotation.Annotation, String) */ public String getAnnotationClassAsString(java.lang.annotation.Annotation annotation, String methodName) { try { Method m = annotation.getClass().getMethod(methodName); if (m.getReturnType() != Class.class) throw new IllegalArgumentException("Method " + methodName + " does not have 'Class' as return type"); try { return Class.class.cast(m.invoke(annotation)).toString(); } catch (AnnotationClassNotAvailableException e) { return e.getClassName(); } } catch (IllegalAccessException e) { throw new IllegalArgumentException("Method " + methodName + " isn't accessible", e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("Method " + methodName + " cannot be invoked", e); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Method " + methodName + " does not exist"); } }
return result; } catch (AnnotationClassNotAvailableException e) { return e.getClassNames();
continue; } catch (ClassNotFoundException e) { classNotAvailable = new AnnotationClassNotAvailableException(val, className); } finally { classNames.add(className); classNotAvailable.setClassNames(classNames); throw classNotAvailable;
continue; } catch (ClassNotFoundException e) { classNotAvailable = new AnnotationClassNotAvailableException(val, className); } finally { classNames.add(className); classNotAvailable.setClassNames(classNames); throw classNotAvailable;
continue; } catch (ClassNotFoundException e) { classNotAvailable = new AnnotationClassNotAvailableException(val, className); } finally { classNames.add(className); classNotAvailable.setClassNames(classNames); throw classNotAvailable;
/** * Use together with {@link #toAnnotationInstance(Class, Annotation)}. * * @see #getAnnotationClassesAsStrings(java.lang.annotation.Annotation, String) */ public String getAnnotationClassAsString(java.lang.annotation.Annotation annotation, String methodName) { try { Method m = annotation.getClass().getMethod(methodName); if (m.getReturnType() != Class.class) throw new IllegalArgumentException("Method " + methodName + " does not have 'Class' as return type"); try { return Class.class.cast(m.invoke(annotation)).toString(); } catch (AnnotationClassNotAvailableException e) { return e.getClassName(); } } catch (IllegalAccessException e) { throw new IllegalArgumentException("Method " + methodName + " isn't accessible", e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("Method " + methodName + " cannot be invoked", e); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Method " + methodName + " does not exist"); } }
return result; } catch (AnnotationClassNotAvailableException e) { return e.getClassNames();
/** * Use together with {@link #toAnnotationInstance(Class, Annotation)}. * * @see #getAnnotationClassesAsStrings(java.lang.annotation.Annotation, String) */ public String getAnnotationClassAsString(java.lang.annotation.Annotation annotation, String methodName) { try { Method m = annotation.getClass().getMethod(methodName); if (m.getReturnType() != Class.class) throw new IllegalArgumentException("Method " + methodName + " does not have 'Class' as return type"); try { return Class.class.cast(m.invoke(annotation)).toString(); } catch (AnnotationClassNotAvailableException e) { return e.getClassName(); } } catch (IllegalAccessException e) { throw new IllegalArgumentException("Method " + methodName + " isn't accessible", e); } catch (InvocationTargetException e) { throw new IllegalArgumentException("Method " + methodName + " cannot be invoked", e); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Method " + methodName + " does not exist"); } }
return result; } catch (AnnotationClassNotAvailableException e) { return e.getClassNames();