@Nullable <A extends Annotation> A getAnnotation(Class<A> annotationClass) { return executable.getAnnotation(annotationClass); }
return RouteParameter.Kind.PATH; boolean formLike = !hasBody && p.getDeclaringExecutable().getAnnotation(POST.class) != null; if (formLike) { return RouteParameter.Kind.FORM;
PetiteInject petiteInject = methodOrCtor.getAnnotation(PetiteInject.class);
public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return executable.getAnnotation(annotationType); }
public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return executable.getAnnotation(annotationType); }
public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return executable.getAnnotation(annotationType); }
public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return executable.getAnnotation(annotationType); }
public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return executable.getAnnotation(annotationType); }
@SuppressWarnings("unchecked") public static <T extends Annotation> T removeAnnotation(Executable ex, Class<T> annotationType) { if (ex.getAnnotation(annotationType) == null) { return null; } ex.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized Map<Class<? extends Annotation>, Annotation> annos; try { annos = (Map<Class<? extends Annotation>, Annotation>) Field_Excutable_DeclaredAnnotations.get(ex); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } return (T) annos.remove(annotationType); }
/** * Add annotation to Executable(Method or Constructor)<br> * Note that you may need to give the root method. * * @param ex * @param annotation * @author XDean * @see Executable * @see #createAnnotationFromMap(Class, Map) * @see ReflectUtil#getRootMethods(Class) */ @SuppressWarnings("unchecked") public static void addAnnotation(Executable ex, Annotation annotation) { ex.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized Map<Class<? extends Annotation>, Annotation> annos; try { annos = (Map<Class<? extends Annotation>, Annotation>) Field_Excutable_DeclaredAnnotations.get(ex); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } if (annos.getClass() == Collections.EMPTY_MAP.getClass()) { annos = new HashMap<>(); try { Field_Excutable_DeclaredAnnotations.set(ex, annos); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } annos.put(annotation.annotationType(), annotation); }
public List<TestCampaign> testGroups(String... groups) throws IllegalAccessException, InvocationTargetException, InstantiationException { List<Executable> ms = new ArrayList<>(); Set<String> ok = Stream.of(groups).collect(Collectors.toSet()); FastClasspathScanner scanner = new FastClasspathScanner(); scanner.matchClassesWithMethodAnnotation(CstrTest.class, (cl, m) -> { CstrTest a = m.getAnnotation(CstrTest.class); for (String g : a.groups()) { if (ok.contains(g)) { ms.add(m); } } }).scan(Runtime.getRuntime().availableProcessors() - 1); return test(ms.toArray(new Method[ms.size()])); } }
private <T extends Annotation> Of<T> elementResolverOf(Executable executable, Class<T> metric) { T annotation = executable.getAnnotation(metric); String name = metricName(executable, metric, metricName(annotation), isMetricAbsolute(annotation)); return new DoesHaveMetric<>(annotation, name); }
private <T extends Annotation> Of<T> elementResolverOf(Executable executable, Class<T> metric) { T annotation = executable.getAnnotation(metric); String name = metricName(executable, metric, metricName(annotation), isMetricAbsolute(annotation)); return new DoesHaveMetric<>(annotation, name); }
return RouteParameter.Kind.PATH; boolean formLike = !hasBody && p.getDeclaringExecutable().getAnnotation(POST.class) != null; if (formLike) { return RouteParameter.Kind.FORM;
PetiteInject petiteInject = methodOrCtor.getAnnotation(PetiteInject.class);