com.github.dynamicextensionsalfresco.aop.MethodAnnotationPointcut Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annotations-runtime Show documentation
Show all versions of annotations-runtime Show documentation
Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features
package com.github.dynamicextensionsalfresco.aop;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.StaticMethodMatcherPointcut;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.Assert;
/**
* {@link Pointcut} that matches methods with a given annotation.
*
* This implementation uses {@link AnnotationUtils#findAnnotation(Method, Class)} to detect annotations on methods.
*
* @author Laurens Fridael
*
*/
class MethodAnnotationPointcut extends StaticMethodMatcherPointcut {
private final Class extends Annotation> annotationType;
MethodAnnotationPointcut(final Class extends Annotation> annotationType) {
Assert.notNull(annotationType);
this.annotationType = annotationType;
}
@Override
public boolean matches(final Method method, final Class> targetClass) {
return AnnotationUtils.findAnnotation(method, annotationType) != null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy