![JAR search and dependency download from the Maven repository](/logo.png)
com.atlassian.bootgraph.api.AnnotationUtil.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bootgraph-core Show documentation
Show all versions of bootgraph-core Show documentation
A library for graphing Spring Boot application code
package com.atlassian.bootgraph.api
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition
import org.springframework.beans.factory.config.BeanDefinition
fun isBeanAnnotated(bean: Any, beanDefinition: BeanDefinition, annotationClazz: Class): Boolean {
return isBeanAnnotatedDirectly(bean, annotationClazz) || isFactoryMethodAnnotated(beanDefinition, annotationClazz)
}
private fun isBeanAnnotatedDirectly(bean: Any, annotationClazz: Class): Boolean {
return bean.javaClass.isAnnotationPresent(annotationClazz)
}
private fun isFactoryMethodAnnotated(beanDefinition: BeanDefinition, annotationClazz: Class): Boolean {
if (beanDefinition !is AnnotatedBeanDefinition) {
return false
}
return beanDefinition.factoryMethodMetadata?.isAnnotated(annotationClazz.name) ?: false
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy