@Test public void extractConditionMatcherFactories_Method() throws Exception { Method method = TestHandler.getTestMethod(); Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> conditionMatcherFactories = CEKRequestMappingHandlerMapping.extractConditionMatcherFactories(method); assertThat(conditionMatcherFactories) .containsOnlyKeys(DummyConditionMatcherFactory.class); assertThat(conditionMatcherFactories.get(DummyConditionMatcherFactory.class)) .isEqualTo(AnnotationUtils.getRepeatableAnnotations(method, DummyCondition.class)); assertThat(conditionMatcherFactories.get(DummyConditionMatcherFactory.class)) .isEqualTo(AnnotatedElementUtils.getMergedRepeatableAnnotations(method, DummyCondition.class)); }
@SuppressWarnings("rawTypes") static Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> extractConditionMatcherFactories(Object beanTypeOrMethod) { Assert.isTrue(beanTypeOrMethod instanceof Class || beanTypeOrMethod instanceof Method, "beanTypeOrMethod should be Class or Method. " + "[beanTypeOrMethod:" + beanTypeOrMethod + "]"); Annotation[] annotations = AnnotationUtils.getAnnotations((AnnotatedElement) beanTypeOrMethod); if (annotations == null || annotations.length == 0) { return Collections.emptyMap(); } return Arrays.stream(annotations) .flatMap(annotation -> searchCEKHandleCondition(annotation).stream()) .collect(groupingBy(annotation -> annotation.annotationType() .getAnnotation(CEKHandleCondition.class) .value(), mapping(Function.identity(), Collectors.toSet()))); }
CEKRequestMappingHandlerMapping implements BeanFactoryAware, InitializingBean { @SuppressWarnings("rawTypes") static Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> extractConditionMatcherFactories(Object beanTypeOrMethod) { Assert.isTrue(beanTypeOrMethod instanceof Class || beanTypeOrMethod instanceof Method, "beanTypeOrMethod should be Class or Method. " + "[beanTypeOrMethod:" + beanTypeOrMethod + "]"); Annotation[] annotations = AnnotationUtils.getAnnotations((AnnotatedElement) beanTypeOrMethod); if (annotations == null || annotations.length == 0) { return Collections.emptyMap(); } return Arrays.stream(annotations) .flatMap(annotation -> searchCEKHandleCondition(annotation).stream()) .collect(groupingBy(annotation -> annotation.annotationType() .getAnnotation(CEKHandleCondition.class) .value(), mapping(Function.identity(), Collectors.toSet()))); } }
CEKRequestMappingHandlerMapping implements BeanFactoryAware, InitializingBean { @SuppressWarnings("rawTypes") static Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> extractConditionMatcherFactories(Object beanTypeOrMethod) { Assert.isTrue(beanTypeOrMethod instanceof Class || beanTypeOrMethod instanceof Method, "beanTypeOrMethod should be Class or Method. " + "[beanTypeOrMethod:" + beanTypeOrMethod + "]"); Annotation[] annotations = AnnotationUtils.getAnnotations((AnnotatedElement) beanTypeOrMethod); if (annotations == null || annotations.length == 0) { return Collections.emptyMap(); } return Arrays.stream(annotations) .flatMap(annotation -> searchCEKHandleCondition(annotation).stream()) .collect(groupingBy(annotation -> annotation.annotationType() .getAnnotation(CEKHandleCondition.class) .value(), mapping(Function.identity(), Collectors.toSet()))); }  }
CEKRequestMappingHandlerMapping implements BeanFactoryAware, InitializingBean { @SuppressWarnings("rawTypes") static Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> extractConditionMatcherFactories(Object beanTypeOrMethod) { Assert.isTrue(beanTypeOrMethod instanceof Class || beanTypeOrMethod instanceof Method, "beanTypeOrMethod should be Class or Method. " + "[beanTypeOrMethod:" + beanTypeOrMethod + "]"); Annotation[] annotations = AnnotationUtils.getAnnotations((AnnotatedElement) beanTypeOrMethod); if (annotations == null || annotations.length == 0) { return Collections.emptyMap(); } return Arrays.stream(annotations) .flatMap(annotation -> searchCEKHandleCondition(annotation).stream()) .collect(groupingBy(annotation -> annotation.annotationType() .getAnnotation(CEKHandleCondition.class) .value(), mapping(Function.identity(), Collectors.toSet()))); }  @Override void afterPropertiesSet(); }
CEKRequestMappingHandlerMapping implements BeanFactoryAware, InitializingBean { @SuppressWarnings("rawTypes") static Map<Class<? extends CEKHandleConditionMatcherFactory>, Set<Annotation>> extractConditionMatcherFactories(Object beanTypeOrMethod) { Assert.isTrue(beanTypeOrMethod instanceof Class || beanTypeOrMethod instanceof Method, "beanTypeOrMethod should be Class or Method. " + "[beanTypeOrMethod:" + beanTypeOrMethod + "]"); Annotation[] annotations = AnnotationUtils.getAnnotations((AnnotatedElement) beanTypeOrMethod); if (annotations == null || annotations.length == 0) { return Collections.emptyMap(); } return Arrays.stream(annotations) .flatMap(annotation -> searchCEKHandleCondition(annotation).stream()) .collect(groupingBy(annotation -> annotation.annotationType() .getAnnotation(CEKHandleCondition.class) .value(), mapping(Function.identity(), Collectors.toSet()))); }  @Override void afterPropertiesSet();  }