use of com.navercorp.pinpoint.plugin.spring.beans.SpringBeansTarget in project pinpoint by naver.
the class TargetBeanFilter method isTarget.
public boolean isTarget(final SpringBeansTargetScope scope, final String beanName, final Class<?> clazz) {
if (scope == null || beanName == null || clazz == null) {
return false;
}
final String className = clazz.getName();
if (className == null) {
return false;
}
if (cache.contains(className)) {
return false;
}
for (SpringBeansTarget target : targets) {
// check scope.
if (target.getScope() != scope) {
continue;
}
boolean condition = false;
// check base packages.
final List<String> basePackages = target.getBasePackages();
if (CollectionUtils.hasLength(basePackages)) {
if (!isBasePackage(target, className)) {
continue;
}
condition = true;
}
// check bean name pattern.
final List<PathMatcher> namePatterns = target.getNamePatterns();
if (CollectionUtils.hasLength(namePatterns)) {
if (!isBeanNameTarget(target, beanName)) {
continue;
}
condition = true;
}
// check class name pattern.
final List<PathMatcher> classPatterns = target.getClassPatterns();
if (CollectionUtils.hasLength(classPatterns)) {
if (!isClassNameTarget(target, className)) {
continue;
}
condition = true;
}
// check class annotation.
final List<String> annotations = target.getAnnotations();
if (CollectionUtils.hasLength(annotations)) {
if (!isAnnotationTarget(target, clazz)) {
continue;
}
condition = true;
}
if (condition) {
// AND condition.
return true;
}
}
return false;
}
use of com.navercorp.pinpoint.plugin.spring.beans.SpringBeansTarget in project pinpoint by naver.
the class TargetBeanFilter method isTarget.
public boolean isTarget(final SpringBeansTargetScope scope, final String beanName, final BeanDefinition beanDefinition) {
if (scope == null || beanName == null || beanDefinition == null) {
return false;
}
final String className = beanDefinition.getBeanClassName();
if (className == null) {
return false;
}
if (cache.contains(className)) {
return false;
}
for (SpringBeansTarget target : targets) {
// check scope.
if (target.getScope() != scope) {
continue;
}
boolean condition = false;
// check base packages.
final List<String> basePackages = target.getBasePackages();
if (CollectionUtils.hasLength(basePackages)) {
if (!isBasePackage(target, className)) {
continue;
}
condition = true;
}
// check bean name pattern.
final List<PathMatcher> namePatterns = target.getNamePatterns();
if (CollectionUtils.hasLength(namePatterns)) {
if (!isBeanNameTarget(target, beanName)) {
continue;
}
condition = true;
}
// check class name pattern.
final List<PathMatcher> classPatterns = target.getClassPatterns();
if (CollectionUtils.hasLength(classPatterns)) {
if (!isClassNameTarget(target, className)) {
continue;
}
condition = true;
}
// check class annotation.
final List<String> annotations = target.getAnnotations();
if (CollectionUtils.hasLength(annotations)) {
if (!(beanDefinition instanceof AnnotatedBeanDefinition) || !isAnnotationTarget(target, (AnnotatedBeanDefinition) beanDefinition)) {
continue;
}
condition = true;
}
if (condition) {
// AND condition.
return true;
}
}
return false;
}
Aggregations