AnnotationPointcut class abstract interface

A marker for pointcuts that match only members or classes carrying annotations from outside package:spring_core_dart, such as @Cacheable or @Validated.

It exists for the build's proxy pruning (aop_prune): the build skips the proxy classes of beans no pointcut can match, but always keeps the beans that carry such an annotation. A starter's auto-configuration that declares an advisor bean whose pointcut is an AnnotationPointcut (in the advisor's static type, as the build sees it) keeps that saving; any other advisor bean of a starter turns pruning off, since the build cannot tell which beans it matches. Implement it in a library that offers annotation-driven advice; applications do not need it.

Read MethodSignature.mergedAnnotations to also see the annotations of the superclass, mixin and interface declarations the member overrides (Spring's AnnotatedElementUtils find semantics), as the cache and method validation advisors do; MethodSignature.annotations is what @annotation(...) matches.

// The cache starter's pointcut: members with @Cacheable.
final class CacheAnnotationPointcut implements AnnotationPointcut {
  const CacheAnnotationPointcut();

  @override
  bool matches(MethodSignature signature, String beanName) =>
      signature.mergedAnnotations.any((a) => a is Cacheable);
}

DefaultPointcutAdvisor(const CacheAnnotationPointcut(), interceptor);

Spring (Java):

new DefaultPointcutAdvisor(
    new AnnotationMatchingPointcut(null, Cacheable.class), interceptor);
Implemented types

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

matches(MethodSignature signature, String beanName) → bool
Whether the advice applies to the member described by signature of the bean named beanName.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited