List of usage examples for org.springframework.core.annotation AnnotationUtils findAnnotationDeclaringClass
@Deprecated @Nullable public static Class<?> findAnnotationDeclaringClass(Class<? extends Annotation> annotationType, @Nullable Class<?> clazz)
From source file:com.cassius.spring.assembly.test.common.toolbox.ContextUtil.java
/** * Gets reuse spring context configure class. * * @param targetClass the target class//ww w . j a va2 s . co m * @return the reuse spring context configure class */ public static Class<?> getSpringContextCacheConfigureClass(Class<?> targetClass) { Class<?> declaringClass = AnnotationUtils.findAnnotationDeclaringClass(SpringAssemblyConfigure.class, targetClass); SpringAssemblyConfigure springAssemblyConfigure = AnnotationUtils.findAnnotation(targetClass, SpringAssemblyConfigure.class); if (declaringClass != null && springAssemblyConfigure != null && springAssemblyConfigure.reuseSpringContext()) { return declaringClass; } return targetClass; }
From source file:guru.qas.martini.annotation.StepsAnnotationProcessor.java
@Override public Object postProcessAfterInitialization(@Nonnull Object bean, String beanName) throws BeansException { try {// w w w.j av a 2 s .c o m Class<?> wrapped = AopUtils.getTargetClass(bean); if (!isSpring(wrapped)) { Class<?> declaring = AnnotationUtils.findAnnotationDeclaringClass(Steps.class, wrapped); if (null != declaring) { processStepsBean(beanName, wrapped); } } return bean; } catch (Exception e) { throw new FatalBeanException("unable to processAnnotationContainer @Steps beans", e); } }
From source file:org.cleverbus.test.AbstractTest.java
/** * Gets set of active route definitions which should be added into Camel context. * * @return set of classes//w w w .j a va2 s. co m */ private Set<Class> getActiveRoutes() { Set<Class> routeClasses = new HashSet<Class>(); Class<ActiveRoutes> annotationType = ActiveRoutes.class; Class<?> testClass = this.getClass(); Class<?> declaringClass = AnnotationUtils.findAnnotationDeclaringClass(annotationType, testClass); if (declaringClass == null) { return routeClasses; } while (declaringClass != null) { ActiveRoutes activeRoutes = declaringClass.getAnnotation(annotationType); routeClasses.addAll(Arrays.asList(activeRoutes.classes())); declaringClass = findAnnotationDeclaringClass(annotationType, declaringClass.getSuperclass()); } return routeClasses; }