com.custardsource.parfait.spring.timing.BeanPredicates Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parfait-spring Show documentation
Show all versions of parfait-spring Show documentation
Library enabling parfait timing collection around Spring beans using Spring AOP
package com.custardsource.parfait.spring.timing;
import com.google.common.base.Predicate;
import org.springframework.beans.factory.config.BeanDefinition;
public class BeanPredicates {
public static Predicate hasAttribute(final String meta, final Object value) {
return new Predicate() {
@Override
public boolean apply(BeanSpecification input) {
BeanDefinition definition = input.getBeanFactory().getBeanDefinition(input.getName());
Object attribute = definition.getAttribute(meta);
return value.equals(attribute);
}
};
}
}