Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

AopUtils.CanApply(IPointcut, Type, Type, Boolean) Method

Can the supplied pointcut apply at all on the supplied targetType?

[Visual Basic]
Public Overloads Shared Sub CanApply( _
   ByVal pointcut As IPointcut, _
   ByVal targetType As Type, _
   ByVal proxyInterfaces As Type, _
   ByVal hasIntroductions As Boolean _
public static bool CanApply(
   IPointcut pointcut,
   Type targetType,
   Type[] proxyInterfaces,
   bool hasIntroductions


The pointcut being tested.
The class being tested.
The interfaces being proxied. If a null reference (Nothing in Visual Basic), all methods on a class may be proxied.
whether or not the advisor chain for the target object includes any introductions.

Return Value

true if the pointcut can apply on any method.


This is an important test as it can be used to optimize out a pointcut for a class.

Invoking this method with a targetType that is an interface type will always yield a false return value.

See Also

AopUtils Class | Spring.Aop.Framework Namespace | AopUtils.CanApply Overload List