Java Code Examples for org.springframework.aop.support.annotation.AnnotationClassFilter

Following code examples demonstrate how to use org.springframework.aop.support.annotation.AnnotationClassFilterfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.aop.support.annotation.AnnotationClassFilterand various code implementation of this class.

    public static final Pointcut getPointcut() {
        NameMatchMethodPointcut result = new NameMatchMethodPointcut();
        result.setClassFilter(new AnnotationClassFilter(Uri.class));
        result.setMappedName("execute");
        return result;
    } 


    public AuthorizationAnnotationMatchingPointcut() {
        this.classFilter = new AnnotationClassFilter(Controller.class, true);
        this.methodMatcher = new AnnotationMethodMatcher(Authorization.class);
    } 

    public void setClassAnnotations(Class<? extends Annotation>[] classAnnotations) {
        ClassFilter[] filters = new ClassFilter[classAnnotations.length];
        for (int i = 0; i < classAnnotations.length; i++) {
            filters[i] = new AnnotationClassFilter(classAnnotations[i]);
        }
        this.classFilter = andClassFilter ? CompositeClassFilter.AND(filters)
                                         : CompositeClassFilter.OR(filters);
    } 

    public PermissionAnnotationMatchingPointcut() {
        this.classFilter = new AnnotationClassFilter(Controller.class, true);
        this.methodMatcher = new AnnotationMethodMatcher(Permission.class);
    } 

    public void testAnnotationClassFilter(){
        AnnotationClassFilter classFilter=new AnnotationClassFilter(Time.class);
        System.out.println(classFilter.matches(ApiService.class));
    } 

Advertisement
Javadoc
Simple ClassFilter that looks for a specific Java 5 annotation being present on a class. @author Jue

rgen Hoeller @since 2.0 @see AnnotationMatchingPointcut

Read More
Advertisement